Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / serviceworker / onactivate-script-error.html
blobfd946e1c911961513327297f2aa085a0358cac6e
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharness-helpers.js"></script>
4 <script src="../resources/testharnessreport.js"></script>
5 <script src="resources/test-helpers.js"></script>
6 <script>
7 function wait_for_install(worker) {
8 return new Promise(function(resolve, reject) {
9 worker.addEventListener('statechange', function(event) {
10 if (worker.state == 'installed')
11 resolve();
12 else if (worker.state == 'redundant')
13 reject();
14 });
15 });
18 function wait_for_activate(worker) {
19 return new Promise(function(resolve, reject) {
20 worker.addEventListener('statechange', function(event) {
21 if (worker.state == 'activated')
22 resolve();
23 else if (worker.state == 'redundant')
24 reject();
25 });
26 });
29 function make_test(name, script) {
30 promise_test(function(t) {
31 var scope = script;
32 var registration;
33 return service_worker_unregister_and_register(t, script, scope)
34 .then(function(r) {
35 registration = r;
36 return wait_for_install(registration.installing);
38 .then(function() {
39 // Activate should succeed regardless of script errors.
40 return wait_for_activate(registration.waiting);
41 });
42 }, name);
47 name: 'activate handler throws an error',
48 script: 'resources/onactivate-throw-error-worker.js',
51 name: 'activate handler throws an error, error handler does not cancel',
52 script: 'resources/onactivate-throw-error-with-empty-onerror-worker.js',
55 name: 'activate handler dispatches an event that throws an error',
56 script: 'resources/onactivate-throw-error-from-nested-event-worker.js',
59 name: 'activate handler throws an error that is cancelled',
60 script: 'resources/onactivate-throw-error-then-cancel-worker.js',
63 name: 'activate handler throws an error and prevents default',
64 script: 'resources/onactivate-throw-error-then-prevent-default-worker.js',
66 ].forEach(function(test_case) {
67 make_test(test_case.name, test_case.script);
68 });
69 </script>