OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <title>Service Worker: Synchronous XHR is intercepted</title> | |
3 <script src="/resources/testharness.js"></script> | |
4 <script src="/resources/testharnessreport.js"></script> | |
5 <script src="resources/test-helpers.sub.js"></script> | |
6 <script> | |
7 'use strict'; | |
8 | |
9 promise_test(function(t) { | |
10 var url = 'resources/fetch-request-xhr-sync-worker.js'; | |
falken
2017/05/31 01:39:33
Suggest comment:
// The |scope| file does not exis
mike3
2017/05/31 16:12:11
That file *does* exist; it's the file requested fr
| |
11 var scope = 'resources/fetch-request-xhr-sync-iframe.html'; | |
12 | |
13 return service_worker_unregister_and_register(t, url, scope) | |
14 .then(function(registration) { | |
15 t.add_cleanup(function() { | |
16 registration.unregister(); | |
17 }); | |
18 | |
19 return wait_for_state(t, registration.installing, 'activated'); | |
20 }) | |
21 .then(function() { return with_iframe(scope); }) | |
22 .then(function(frame) { | |
23 t.add_cleanup(function() { | |
24 frame.remove(); | |
25 }); | |
26 | |
27 return new Promise(function(resolve, reject) { | |
28 setTimeout(function() { | |
29 try { | |
30 assert_equals( | |
31 frame.contentWindow.performSyncXHR(), | |
32 200, | |
33 'HTTP response status code for intercepted request' | |
34 ); | |
falken
2017/05/31 01:39:33
Adding an assert for the body text should be fine
mike3
2017/05/31 16:12:11
Acknowledged.
| |
35 resolve(); | |
36 } catch (err) { | |
37 reject(err); | |
38 } | |
39 }, 0); | |
40 }); | |
41 }); | |
42 }, 'Verify SyncXHR is intercepted'); | |
43 </script> | |
OLD | NEW |