| Index: LayoutTests/http/tests/serviceworker/controller-on-reload.html
|
| diff --git a/LayoutTests/http/tests/serviceworker/controller-on-reload.html b/LayoutTests/http/tests/serviceworker/controller-on-reload.html
|
| index a91ea6db3df036309907a966ad9cbb91450d86cd..068a3b64f523da9702f3641edf6ea526eadf7dd1 100644
|
| --- a/LayoutTests/http/tests/serviceworker/controller-on-reload.html
|
| +++ b/LayoutTests/http/tests/serviceworker/controller-on-reload.html
|
| @@ -20,21 +20,6 @@ t.step(function() {
|
|
|
| function onIframeLoad(frame) {
|
| var w = frame.contentWindow;
|
| -
|
| - function onActive(event) {
|
| - assert_equals(w.navigator.serviceWorker.controller, null,
|
| - 'controller should be null until the document is reloaded');
|
| - reloaded = true;
|
| - w.location.reload();
|
| - }
|
| -
|
| - function onRegister(worker) {
|
| - worker.addEventListener('statechange', t.step_func(function(event) {
|
| - if (event.target.state == 'activated')
|
| - onActive();
|
| - }));
|
| - }
|
| -
|
| if (reloaded) {
|
| assert_true(w.navigator.serviceWorker.controller instanceof w.ServiceWorker,
|
| 'controller should be a ServiceWorker object upon reload');
|
| @@ -42,12 +27,21 @@ t.step(function() {
|
| return;
|
| }
|
|
|
| - w.navigator.serviceWorker.register(
|
| - 'worker-no-op.js', {scope: 'blank.html'}
|
| - ).then(
|
| - t.step_func(onRegister),
|
| - unreached_rejection(t, 'Registration should succeed, but failed')
|
| - );
|
| + w.navigator.serviceWorker.register('worker-no-op.js',
|
| + {scope: 'blank.html'})
|
| + .then(function(registration) {
|
| + return wait_for_update(t, registration);
|
| + })
|
| + .then(function(worker) {
|
| + return wait_for_state(t, worker, 'activated');
|
| + })
|
| + .then(function() {
|
| + assert_equals(w.navigator.serviceWorker.controller, null,
|
| + 'controller should be null until the document is reloaded');
|
| + reloaded = true;
|
| + w.location.reload();
|
| + })
|
| + .catch(unreached_rejection(t));
|
| }
|
| });
|
| </script>
|
|
|