| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Service Worker: Register() on Closed Window</title> | 2 <title>Service Worker: Register() on Closed Window</title> |
| 3 <meta name=timeout content=long> | 3 <meta name=timeout content=long> |
| 4 <script src="/resources/testharness.js"></script> | 4 <script src="/resources/testharness.js"></script> |
| 5 <script src="resources/testharness-helpers.js"></script> | 5 <script src="resources/testharness-helpers.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="resources/get-host-info.sub.js"></script> | 7 <script src="/common/get-host-info.sub.js"></script> |
| 8 <script src="resources/test-helpers.sub.js"></script> | 8 <script src="resources/test-helpers.sub.js"></script> |
| 9 <body> | 9 <body> |
| 10 <script> | 10 <script> |
| 11 | 11 |
| 12 var host_info = get_host_info(); | 12 var host_info = get_host_info(); |
| 13 var frameURL = host_info['HTTPS_ORIGIN'] + base_path() + | 13 var frameURL = host_info['HTTPS_ORIGIN'] + base_path() + |
| 14 'resources/register-closed-window-iframe.html'; | 14 'resources/register-closed-window-iframe.html'; |
| 15 | 15 |
| 16 async_test(function(t) { | 16 async_test(function(t) { |
| 17 var frame; | 17 var frame; |
| 18 with_iframe(frameURL).then(function(f) { | 18 with_iframe(frameURL).then(function(f) { |
| 19 frame = f; | 19 frame = f; |
| 20 return new Promise(function(resolve) { | 20 return new Promise(function(resolve) { |
| 21 window.addEventListener('message', function messageHandler(evt) { | 21 window.addEventListener('message', function messageHandler(evt) { |
| 22 window.removeEventListener('message', messageHandler); | 22 window.removeEventListener('message', messageHandler); |
| 23 resolve(evt.data); | 23 resolve(evt.data); |
| 24 }); | 24 }); |
| 25 frame.contentWindow.postMessage('START', '*'); | 25 frame.contentWindow.postMessage('START', '*'); |
| 26 }); | 26 }); |
| 27 }).then(function(result) { | 27 }).then(function(result) { |
| 28 assert_equals(result, 'OK', 'frame should complete without crashing'); | 28 assert_equals(result, 'OK', 'frame should complete without crashing'); |
| 29 frame.remove(); | 29 frame.remove(); |
| 30 t.done(); | 30 t.done(); |
| 31 }).catch(unreached_rejection(t)); | 31 }).catch(unreached_rejection(t)); |
| 32 }, 'Call register() on ServiceWorkerContainer owned by closed window.'); | 32 }, 'Call register() on ServiceWorkerContainer owned by closed window.'); |
| 33 | 33 |
| 34 </script> | 34 </script> |
| 35 </body> | 35 </body> |
| OLD | NEW |