| Index: LayoutTests/http/tests/serviceworker/unregister-then-register-new-script.html
|
| diff --git a/LayoutTests/http/tests/serviceworker/unregister-then-register-new-script.html b/LayoutTests/http/tests/serviceworker/unregister-then-register-new-script.html
|
| index 7cf9a3a88558273d333ced65d123fb47e2eacbe0..baf22ff77fe961dc5f99caaacf9961bafd55719f 100644
|
| --- a/LayoutTests/http/tests/serviceworker/unregister-then-register-new-script.html
|
| +++ b/LayoutTests/http/tests/serviceworker/unregister-then-register-new-script.html
|
| @@ -6,53 +6,7 @@
|
| var worker_url = 'resources/empty-worker.js';
|
|
|
| async_test(function(t) {
|
| - var scope = 'scope/register-waits-for-unregistered-registration-to-clear';
|
| - var new_worker_url = worker_url + '?new';
|
| - var iframe;
|
| - var registration;
|
| - var unloaded = false;
|
| -
|
| - service_worker_unregister_and_register(t, worker_url, scope)
|
| - .then(function(r) {
|
| - registration = r;
|
| - return wait_for_update(t, registration);
|
| - })
|
| - .then(function(worker) {
|
| - return wait_for_state(t, worker, 'activated');
|
| - })
|
| - .then(function() {
|
| - return with_iframe(scope);
|
| - })
|
| - .then(function(frame) {
|
| - iframe = frame;
|
| - return registration.unregister();
|
| - })
|
| - .then(function() {
|
| - setTimeout(function() {
|
| - unloaded = true;
|
| - unload_iframe(iframe);
|
| - }, 10);
|
| - return navigator.serviceWorker.register(new_worker_url,
|
| - { scope: scope });
|
| - })
|
| - .then(function(new_registration) {
|
| - assert_true(unloaded,
|
| - 'register should not resolve until iframe unloaded');
|
| - assert_equals(registration.installing, null,
|
| - 'registration.installing');
|
| - assert_equals(registration.waiting, null, 'registration.waiting');
|
| - assert_equals(registration.active, null, 'registration.active');
|
| - return new_registration.unregister();
|
| - })
|
| - .then(function() {
|
| - t.done();
|
| - })
|
| - .catch(unreached_rejection(t));
|
| - }, 'Registering a new script URL does not resolve until unregistered ' +
|
| - 'registration is cleared');
|
| -
|
| -async_test(function(t) {
|
| - var scope = 'scope/unregister-then-register-new-script';
|
| + var scope = 'scope/new-worker';
|
| var new_worker_url = worker_url + '?new';
|
| var iframe;
|
| var registration;
|
| @@ -73,31 +27,14 @@
|
| return registration.unregister();
|
| })
|
| .then(function() {
|
| - var promise = navigator.serviceWorker.register(new_worker_url,
|
| - { scope: scope });
|
| - unload_iframe(iframe);
|
| - return promise;
|
| + // FIXME: Register should not resolve until controllees are unloaded.
|
| + return navigator.serviceWorker.register(new_worker_url,
|
| + { scope: scope });
|
| })
|
| .then(function(new_registration) {
|
| - assert_not_equals(registration, new_registration,
|
| - 'register() should resolve to a new registration');
|
| - assert_equals(registration.installing, null,
|
| - 'old registration.installing');
|
| - assert_equals(registration.waiting, null,
|
| - 'old registration.waiting');
|
| - assert_equals(registration.active, null,
|
| - 'old registration.active');
|
| - registration = new_registration;
|
| - return wait_for_update(t, registration);
|
| + return wait_for_update(t, new_registration);
|
| })
|
| .then(function(worker) {
|
| - assert_equals(registration.installing.scriptURL,
|
| - normalizeURL(new_worker_url),
|
| - 'new registration.installing');
|
| - assert_equals(registration.waiting, null,
|
| - 'new registration.waiting');
|
| - assert_equals(registration.active, null,
|
| - 'new registration.active');
|
| return wait_for_state(t, worker, 'activated');
|
| })
|
| .then(function() {
|
| @@ -107,18 +44,14 @@
|
| assert_equals(
|
| frame.contentWindow.navigator.serviceWorker.controller.scriptURL,
|
| normalizeURL(new_worker_url),
|
| - 'the new worker should control a new document');
|
| - unload_iframe(frame);
|
| - return registration.unregister();
|
| - })
|
| - .then(function() {
|
| - t.done();
|
| + 'document controller is the new worker');
|
| + service_worker_unregister_and_done(t, scope);
|
| })
|
| .catch(unreached_rejection(t));
|
| -}, 'Registering a new script URL while an unregistered registration is in use');
|
| +}, 'Unregister then register a new script URL');
|
|
|
| async_test(function(t) {
|
| - var scope = 'scope/unregister-then-register-new-script-that-404s';
|
| + var scope = 'scope/non-existent-worker';
|
| var iframe;
|
| var registration;
|
|
|
| @@ -138,31 +71,32 @@
|
| return registration.unregister();
|
| })
|
| .then(function() {
|
| - var promise = navigator.serviceWorker.register('this-will-404',
|
| - { scope: scope });
|
| - unload_iframe(iframe);
|
| - return promise;
|
| + // FIXME: Register should not resolve until controllees are unloaded.
|
| + return navigator.serviceWorker.register('this-will-404',
|
| + { scope: scope });
|
| })
|
| .then(
|
| function() {
|
| assert_unreached('register should reject the promise');
|
| },
|
| function() {
|
| + return unload_iframe(iframe);
|
| + })
|
| + .then(function() {
|
| return with_iframe(scope);
|
| })
|
| .then(function(frame) {
|
| assert_equals(frame.contentWindow.navigator.serviceWorker.controller,
|
| null,
|
| 'document should not load with a controller');
|
| - unload_iframe(frame);
|
| - t.done();
|
| + service_worker_unregister_and_done(t, scope);
|
| })
|
| .catch(unreached_rejection(t));
|
| }, 'Registering a new script URL that 404s does not resurrect an ' +
|
| 'unregistered registration');
|
|
|
| async_test(function(t) {
|
| - var scope = 'scope/unregister-then-register-reject-install-worker';
|
| + var scope = 'scope/reject-install-worker';
|
| var iframe;
|
| var registration;
|
|
|
| @@ -182,17 +116,18 @@
|
| return registration.unregister();
|
| })
|
| .then(function() {
|
| - var promise = navigator.serviceWorker.register(
|
| + // FIXME: Register should not resolve until controllees are unloaded.
|
| + return navigator.serviceWorker.register(
|
| 'resources/reject-install-worker.js', { scope: scope });
|
| - unload_iframe(iframe);
|
| - return promise;
|
| })
|
| - .then(function(r) {
|
| - registration = r;
|
| - return wait_for_update(t, registration);
|
| + .then(function(new_registration) {
|
| + return wait_for_update(t, new_registration);
|
| })
|
| .then(function(worker) {
|
| return wait_for_state(t, worker, 'redundant');
|
| + })
|
| + .then(function(worker) {
|
| + return unload_iframe(iframe);
|
| })
|
| .then(function() {
|
| return with_iframe(scope);
|
| @@ -201,11 +136,7 @@
|
| assert_equals(frame.contentWindow.navigator.serviceWorker.controller,
|
| null,
|
| 'document should not load with a controller');
|
| - unload_iframe(frame);
|
| - return registration.unregister();
|
| - })
|
| - .then(function() {
|
| - t.done();
|
| + service_worker_unregister_and_done(t, scope);
|
| })
|
| .catch(unreached_rejection(t));
|
| }, 'Registering a new script URL that fails to install does not resurrect ' +
|
|
|