Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <script src="../../../resources/testharness.js"></script> | |
| 2 <script src="../../../serviceworker/resources/test-helpers.js?pipe=sub"></script > | |
| 3 <script> | |
| 4 var port = undefined; | |
| 5 var scope = 'fetch-request-body-file-test'; | |
| 6 var script = 'fetch-request-body-file-worker.js'; | |
| 7 | |
| 8 window.addEventListener('message', function(evt) { | |
| 9 port = evt.ports[0]; | |
| 10 start(); | |
| 11 }, false); | |
| 12 | |
| 13 function start() { | |
| 14 if (location.search == '?register') { | |
| 15 async_test(function(t) { | |
|
nhiroki
2014/08/27 03:52:34
Would it be possible to remove async_test() from h
horo
2014/08/27 05:05:45
I introduced this in order to use wait_for_update
nhiroki
2014/08/27 05:23:21
I see... I didn't mean to reuse the wait_for_updat
horo
2014/08/27 06:01:54
Done.
| |
| 16 service_worker_unregister_and_register(t, script, scope) | |
|
nhiroki
2014/08/27 03:52:34
Question: Why don't you call register()/unregister
horo
2014/08/27 05:05:45
In layouttest, fetch-request-body-file.html is ope
nhiroki
2014/08/27 05:23:21
Acknowledged.
| |
| 17 .then(function(registration) { | |
| 18 return wait_for_update(t, registration); | |
| 19 }) | |
| 20 .then(function(worker) { | |
| 21 port.postMessage({msg: 'registered'}); | |
| 22 }) | |
| 23 .catch(function() { | |
| 24 port.postMessage({msg: 'registration error'}); | |
| 25 }); | |
| 26 }, 'Register ServiceWorker'); | |
| 27 } else if (location.search == '?unregister') { | |
| 28 async_test(function(t) { | |
|
nhiroki
2014/08/27 03:52:34
ditto (removing async_test).
| |
| 29 navigator.serviceWorker.register(script, {scope: scope}) | |
| 30 .then(function(registration) { | |
| 31 return registration.unregister(); | |
| 32 }) | |
| 33 .then(function() { | |
| 34 port.postMessage({msg: 'unregistered'}); | |
| 35 }) | |
| 36 .catch(function() { | |
| 37 port.postMessage({msg: 'unregistration error'}); | |
| 38 }); | |
| 39 }, 'Unregister ServiceWorker'); | |
| 40 } | |
| 41 } | |
| 42 </script> | |
| OLD | NEW |