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'; |
| 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 'hello', |
| 33 'value of responseText' |
| 34 ); |
| 35 resolve(); |
| 36 } catch (err) { |
| 37 reject(err); |
| 38 } |
| 39 }, 0); |
| 40 }); |
| 41 }); |
| 42 }, 'Verify SyncXHR is intercepted'); |
| 43 </script> |
OLD | NEW |