| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Service Worker: FetchEvent for HTMLImports</title> | 2 <title>Service Worker: FetchEvent for HTMLImports</title> |
| 3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="../resources/get-host-info.js"></script> | 5 <script src="../resources/get-host-info.js"></script> |
| 6 <script src="resources/test-helpers.js?pipe=sub"></script> | 6 <script src="resources/test-helpers.js?pipe=sub"></script> |
| 7 <script> | 7 <script> |
| 8 async_test(function(t) { | 8 async_test(function(t) { |
| 9 var SCOPE = 'resources/fetch-request-html-imports-iframe.html'; | 9 var SCOPE = 'resources/fetch-request-html-imports-iframe.html'; |
| 10 var SCRIPT = 'resources/fetch-request-html-imports-worker.js'; | 10 var SCRIPT = 'resources/fetch-request-html-imports-worker.js'; |
| 11 var host_info = get_host_info(); | 11 var host_info = get_host_info(); |
| 12 service_worker_unregister_and_register(t, SCRIPT, SCOPE) | 12 service_worker_unregister_and_register(t, SCRIPT, SCOPE) |
| 13 .then(function(registration) { | 13 .then(function(registration) { |
| 14 return wait_for_state(t, registration.installing, 'activated'); | 14 return wait_for_state(t, registration.installing, 'activated'); |
| 15 }) | 15 }) |
| 16 .then(function() { return with_iframe(SCOPE); }) | 16 .then(function() { return with_iframe(SCOPE); }) |
| 17 .then(function(frame) { | 17 .then(function(frame) { |
| 18 var same = frame.contentWindow.document.getElementById("same").import; | 18 var same = frame.contentWindow.document.getElementById("same").import; |
| 19 var same_same = same.getElementById("same-same").import; | 19 var same_same = same.getElementById("same-same").import; |
| 20 var same_other = same.getElementById("same-other").import; | 20 var same_other = same.getElementById("same-other").import; |
| 21 var other = | 21 var other = |
| 22 frame.contentWindow.document.getElementById("other").import; | 22 frame.contentWindow.document.getElementById("other").import; |
| 23 var other_same = other.getElementById("other-same").import; | 23 var other_same = other.getElementById("other-same").import; |
| 24 var other_other = other.getElementById("other-other").import; | 24 var other_other = other.getElementById("other-other").import; |
| 25 | 25 |
| 26 assert_equals( | 26 assert_equals( |
| 27 same.body.innerText, | 27 same.body.innerText, |
| 28 'mode=cors credentials=include', | 28 'mode=cors credentials=same-origin', |
| 29 'The request mode and credentials for same origin HTMLImport ' + | 29 'The request mode and credentials for same origin HTMLImport ' + |
| 30 'must be set correctly.'); | 30 'must be set correctly.'); |
| 31 assert_equals( | 31 assert_equals( |
| 32 same_same.body.innerText, | 32 same_same.body.innerText, |
| 33 'mode=cors credentials=include', | 33 'mode=cors credentials=same-origin', |
| 34 'The request mode and credentials for same origin HTMLImport ' + | 34 'The request mode and credentials for same origin HTMLImport ' + |
| 35 'from same origin HTMLImports must be set correctly.'); | 35 'from same origin HTMLImports must be set correctly.'); |
| 36 assert_equals( | 36 assert_equals( |
| 37 same_other.body.innerText, | 37 same_other.body.innerText, |
| 38 'mode=cors credentials=omit', | 38 'mode=cors credentials=same-origin', |
| 39 'The request mode and credentials for other origin HTMLImport ' + | 39 'The request mode and credentials for other origin HTMLImport ' + |
| 40 'from same origin HTMLImports must be set correctly.'); | 40 'from same origin HTMLImports must be set correctly.'); |
| 41 assert_equals( | 41 assert_equals( |
| 42 other.body.innerText, | 42 other.body.innerText, |
| 43 'mode=cors credentials=omit', | 43 'mode=cors credentials=same-origin', |
| 44 'The request mode and credentials for other origin HTMLImport ' + | 44 'The request mode and credentials for other origin HTMLImport ' + |
| 45 'must be set correctly.'); | 45 'must be set correctly.'); |
| 46 assert_equals( | 46 assert_equals( |
| 47 other_same.body.innerText, | 47 other_same.body.innerText, |
| 48 'mode=cors credentials=include', | 48 'mode=cors credentials=same-origin', |
| 49 'The request mode and credentials for same origin HTMLImport ' + | 49 'The request mode and credentials for same origin HTMLImport ' + |
| 50 'from other origin HTMLImports must be set correctly.'); | 50 'from other origin HTMLImports must be set correctly.'); |
| 51 assert_equals( | 51 assert_equals( |
| 52 other_other.body.innerText, | 52 other_other.body.innerText, |
| 53 'mode=cors credentials=omit', | 53 'mode=cors credentials=same-origin', |
| 54 'The request mode and credentials for other origin HTMLImport ' + | 54 'The request mode and credentials for other origin HTMLImport ' + |
| 55 'from other origin HTMLImport must be set correctly.'); | 55 'from other origin HTMLImport must be set correctly.'); |
| 56 | 56 |
| 57 service_worker_unregister_and_done(t, SCOPE); | 57 service_worker_unregister_and_done(t, SCOPE); |
| 58 }) | 58 }) |
| 59 .catch(unreached_rejection(t)); | 59 .catch(unreached_rejection(t)); |
| 60 }, 'Verify the FetchEvent for HTMLImports'); | 60 }, 'Verify the FetchEvent for HTMLImports'); |
| 61 </script> | 61 </script> |
| OLD | NEW |