| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="/resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="resources/testharness-helpers.js"></script> |
| 4 <script src="resources/test-helpers.js"></script> | 4 <script src="/resources/testharnessreport.js"></script> |
| 5 <script src="resources/test-helpers.sub.js"></script> |
| 5 <script> | 6 <script> |
| 6 function wait_for_install_event(worker) { | 7 function wait_for_install_event(worker) { |
| 7 return new Promise(function(resolve) { | 8 return new Promise(function(resolve) { |
| 8 worker.addEventListener('statechange', function(event) { | 9 worker.addEventListener('statechange', function(event) { |
| 9 if (worker.state == 'installed') | 10 if (worker.state == 'installed') |
| 10 resolve(true); | 11 resolve(true); |
| 11 else if (worker.state == 'redundant') | 12 else if (worker.state == 'redundant') |
| 12 resolve(false); | 13 resolve(false); |
| 13 }); | 14 }); |
| 14 }); | 15 }); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 40 expect_install: false | 41 expect_install: false |
| 41 }, | 42 }, |
| 42 { | 43 { |
| 43 name: 'install handler dispatches an event that throws an error', | 44 name: 'install handler dispatches an event that throws an error', |
| 44 script: 'resources/oninstall-throw-error-from-nested-event-worker.js', | 45 script: 'resources/oninstall-throw-error-from-nested-event-worker.js', |
| 45 expect_install: true | 46 expect_install: true |
| 46 }, | 47 }, |
| 47 | 48 |
| 48 // The following two cases test what happens when the ServiceWorkerGlobalScope | 49 // The following two cases test what happens when the ServiceWorkerGlobalScope |
| 49 // 'error' event handler cancels the resulting error event. Since the | 50 // 'error' event handler cancels the resulting error event. Since the |
| 50 // original 'install' event handler threw, the installation should still | 51 // original 'install' event handler through, the installation should still |
| 51 // be stopped in this case. See: | 52 // be stopped in this case. See: |
| 52 // https://github.com/slightlyoff/ServiceWorker/issues/778 | 53 // https://github.com/slightlyoff/ServiceWorker/issues/778 |
| 53 { | 54 { |
| 54 name: 'install handler throws an error that is cancelled', | 55 name: 'install handler throws an error that is cancelled', |
| 55 script: 'resources/oninstall-throw-error-then-cancel-worker.js', | 56 script: 'resources/oninstall-throw-error-then-cancel-worker.js', |
| 56 expect_install: false | 57 expect_install: false |
| 57 }, | 58 }, |
| 58 { | 59 { |
| 59 name: 'install handler throws an error and prevents default', | 60 name: 'install handler throws an error and prevents default', |
| 60 script: 'resources/oninstall-throw-error-then-prevent-default-worker.js', | 61 script: 'resources/oninstall-throw-error-then-prevent-default-worker.js', |
| 61 expect_install: false | 62 expect_install: false |
| 62 } | 63 } |
| 63 ].forEach(function(test_case) { | 64 ].forEach(function(test_case) { |
| 64 make_test(test_case.name, test_case.script, test_case.expect_install); | 65 make_test(test_case.name, test_case.script, test_case.expect_install); |
| 65 }); | 66 }); |
| 66 </script> | 67 </script> |
| OLD | NEW |