OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <meta charset="utf-8"> | |
3 <title>Navigation Preload request must abort when the page load finished</title> | |
4 <script src="../../resources/testharness.js"></script> | |
5 <script src="../../resources/testharnessreport.js"></script> | |
6 <script src="../resources/test-helpers.js"></script> | |
7 <script> | |
8 promise_test(t => { | |
9 var script = 'resources/abort-when-responded-worker.js'; | |
10 var scope = 'resources/abort-when-responded-scope.php'; | |
11 var worker; | |
12 return service_worker_unregister_and_register(t, script, scope) | |
13 .then(registration => { | |
14 add_completion_callback(_ => registration.unregister()); | |
15 worker = registration.installing; | |
16 return wait_for_state(t, worker, 'activated'); | |
17 }) | |
18 .then(_ => with_iframe(scope)) | |
19 .then(frame => { | |
20 assert_equals(frame.contentDocument.body.textContent, 'OK'); | |
21 }) | |
22 .then(_ => { | |
23 var saw_message = new Promise(resolve => { | |
24 navigator.serviceWorker.onmessage = | |
25 e => { resolve(e.data); }; | |
26 }); | |
27 worker.postMessage(''); | |
28 return saw_message; | |
29 }) | |
30 .then(txt => { | |
31 assert_equals( | |
32 txt, | |
33 'REJECTED: NetworkError: Service Worker navigation preload ' + | |
34 'network error.'); | |
falken
2017/01/19 01:27:37
Testing the error string isn't right for an WPT te
| |
35 }); | |
36 }, 'Navigation Preload request must abort when the page load finished.'); | |
37 </script> | |
OLD | NEW |