OLD | NEW |
| (Empty) |
1 importScripts('../../resources/testharness.js'); | |
2 | |
3 let echo_output = null; | |
4 | |
5 // Tests importing a script that sets |echo_output| to the query string. | |
6 function test_import(str) { | |
7 importScripts('echo.php?' + str); | |
8 assert_equals(echo_output, str); | |
9 } | |
10 | |
11 test_import('root'); | |
12 test_import('root-and-message'); | |
13 | |
14 self.addEventListener('install', () => { | |
15 test_import('install'); | |
16 test_import('install-and-message'); | |
17 }); | |
18 | |
19 self.addEventListener('message', e => { | |
20 test_import('root-and-message'); | |
21 test_import('install-and-message'); | |
22 // TODO(falken): This should fail. The spec disallows importing a non-cached | |
23 // script like this but currently Chrome and Firefox allow it. | |
24 test_import('message'); | |
25 e.source.postMessage('OK'); | |
26 }); | |
OLD | NEW |