Skip to content

Instantly share code, notes, and snippets.

@jugglinmike
Created May 25, 2017 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugglinmike/b2d3b637d6f58869ce9450523368a991 to your computer and use it in GitHub Desktop.
Save jugglinmike/b2d3b637d6f58869ce9450523368a991 to your computer and use it in GitHub Desktop.
sw-migration-unregister.diff
$ git diff --no-index third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/reject-install-worker.js third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/reject-install-worker.js
$ git diff --no-index third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/unregister-controller-page.html third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/unregister-controller-page.html
$ git diff --no-index third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-controller.html third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-controller.https.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-controller.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-controller.https.html
index fc05f77..3bf4cff 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-controller.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-controller.https.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
<script>
var worker_url = 'resources/simple-intercept-worker.js';
@@ -11,6 +11,7 @@ async_test(function(t) {
var frame_window;
var controller;
var registration;
+ var frame;
service_worker_unregister_and_register(t, worker_url, scope)
.then(function(r) {
@@ -20,7 +21,8 @@ async_test(function(t) {
.then(function() {
return with_iframe(scope);
})
- .then(function(frame) {
+ .then(function(f) {
+ frame = f;
frame_window = frame.contentWindow;
controller = frame_window.navigator.serviceWorker.controller;
assert_true(controller instanceof frame_window.ServiceWorker,
@@ -36,6 +38,7 @@ async_test(function(t) {
.then(function(response) {
assert_equals(response, 'intercepted by service worker',
'controller should intercept requests');
+ frame.remove();
t.done();
})
.catch(unreached_rejection(t));
@@ -45,6 +48,7 @@ async_test(function(t) {
var scope =
'resources/unregister-controller-page.html?load-after-unregister';
var registration;
+ var frame;
service_worker_unregister_and_register(t, worker_url, scope)
.then(function(r) {
@@ -57,7 +61,8 @@ async_test(function(t) {
.then(function() {
return with_iframe(scope);
})
- .then(function(frame) {
+ .then(function(f) {
+ frame = f;
var frame_window = frame.contentWindow;
assert_equals(frame_window.navigator.serviceWorker.controller, null,
'document should not have a controller');
@@ -66,6 +71,7 @@ async_test(function(t) {
.then(function(response) {
assert_equals(response, 'a simple text file\n',
'requests should not be intercepted');
+ frame.remove();
t.done();
})
.catch(unreached_rejection(t));
@@ -94,6 +100,7 @@ async_test(function(t) {
assert_equals(frame.contentWindow.navigator.serviceWorker.controller,
null,
'document should not have a controller');
+ frame.remove();
t.done();
})
.catch(unreached_rejection(t));
$ git diff --no-index third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register-new-script.html third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-then-register-new-script.https.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register-new-script.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-then-register-new-script.https.html
index cc5ee79..385430c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register-new-script.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-then-register-new-script.https.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
<script>
var worker_url = 'resources/empty-worker.js';
$ git diff --no-index third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-then-register.https.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-then-register.https.html
index 75db25c..d75904d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister-then-register.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister-then-register.https.html
@@ -1,13 +1,12 @@
<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
<script>
var worker_url = 'resources/empty-worker.js';
async_test(function(t) {
var scope = 'resources/scope/re-register-resolves-to-new-value';
- var iframe;
var registration;
service_worker_unregister_and_register(t, worker_url, scope)
@@ -49,7 +48,7 @@ async_test(function(t) {
})
.then(function(new_registration) {
assert_equals(registration, new_registration,
- 'register should resolve to the same registration');
+ 'new registration should resolve to the same registration');
service_worker_unregister_and_done(t, scope);
})
.catch(unreached_rejection(t));
@@ -57,45 +56,6 @@ async_test(function(t) {
'registration is in use.');
async_test(function(t) {
- var scope = 'resources/scope/complete-unregistration-followed-by-' +
- 'reloading-controllee-iframe';
- var registration;
- var frame;
- var service_worker;
- service_worker_unregister_and_register(t, worker_url, scope)
- .then(function(r) {
- registration = r;
- return wait_for_state(t, r.installing, 'activated');
- })
- .then(function() {
- return with_iframe(scope);
- })
- .then(function(f) {
- frame = f;
- return registration.unregister();
- })
- .then(function() {
- return new Promise(function(resolve) {
- frame.onload = resolve;
- frame.contentWindow.location.reload();
- });
- })
- .then(function() {
- var c = frame.contentWindow.navigator.serviceWorker.controller;
- assert_equals(c, null, 'a page after unregistration should not be ' +
- 'controlled by service worker');
- return navigator.serviceWorker.getRegistration(scope);
- })
- .then(function(r) {
- assert_equals(r, undefined, 'getRegistration should return ' +
- 'undefined after unregistration');
- service_worker_unregister_and_done(t, scope);
- })
- .catch(unreached_rejection(t));
-}, 'Reloading the last controlled iframe after unregistration should ensure ' +
- 'the deletion of the registration');
-
-async_test(function(t) {
var scope = 'resources/scope/re-register-does-not-affect-existing-controllee';
var iframe;
var registration;
@@ -125,6 +85,7 @@ async_test(function(t) {
iframe.contentWindow.navigator.serviceWorker.controller,
controller,
'the worker from the first registration is the controller');
+ iframe.remove();
service_worker_unregister_and_done(t, scope);
})
.catch(unreached_rejection(t));
@@ -160,6 +121,7 @@ async_test(function(t) {
assert_not_equals(
frame.contentWindow.navigator.serviceWorker.controller, null,
'document should have a controller');
+ frame.remove();
service_worker_unregister_and_done(t, scope);
})
.catch(unreached_rejection(t));
$ git diff --no-index third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister.html third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister.https.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister.https.html
index 54be479..492aecb 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/unregister.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/unregister.https.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-<script src="resources/test-helpers.js"></script>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.sub.js"></script>
<script>
async_test(function(t) {
var scope = 'resources/scope/unregister-twice';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment