Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/resources/end-to-end-worker.js |
| diff --git a/LayoutTests/http/tests/serviceworker/resources/end-to-end-worker.js b/LayoutTests/http/tests/serviceworker/resources/end-to-end-worker.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..30789ad3871d3b3656808a8386d3ad99ff182ac9 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/resources/end-to-end-worker.js |
| @@ -0,0 +1,17 @@ |
| +oninstall = function(e) { |
| + e.waitUntil(new Promise(function(r) { setTimeout(r, 5); })); |
|
jsbell
2014/04/16 17:43:38
I'm not happy with using setTimeout in this test.
kinuko
2014/04/17 11:32:54
I wanted to make this test dead simple / 'minimal'
|
| +}; |
| + |
| +onactivate = function(e) { |
| + e.waitUntil(new Promise(function(r) { setTimeout(r, 5); })); |
| +}; |
| + |
| +onmessage = function(e) { |
| + var message = e.data; |
| + if (typeof message === 'object' && 'port' in message) { |
|
jsbell
2014/04/16 17:43:38
FWIW, `typeof null === 'object'`; the `Object(x) =
kinuko
2014/04/17 11:32:54
Yup, sgtm, please feel free to fix it.
|
| + var response = 'Ack for: ' + message.from; |
| + try { |
| + message.port.postMessage(response); |
| + } catch (_) {} |
| + } |
| +}; |