Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/unregister-worker.js

Issue 900793002: ServiceWorker: Support SWRegistration.unregister() in SWGlobalScope [2/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update layout tests and header comment Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/unregister.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/unregister-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/unregister-worker.js b/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/unregister-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..6cee5365428d492f574a15b248a97a18d5477440
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/unregister-worker.js
@@ -0,0 +1,23 @@
+function matchQuery(query) {
+ return self.location.href.indexOf(query) != -1;
+}
+
+if (matchQuery('?evaluation'))
+ self.registration.unregister();
+
+self.addEventListener('install', function(e) {
+ if (matchQuery('?install'))
+ self.registration.unregister();
+ });
+
+self.addEventListener('activate', function(e) {
+ if (matchQuery('?activate'))
+ self.registration.unregister();
+ });
+
+self.addEventListener('message', function(e) {
+ self.registration.unregister()
+ .then(function(result) {
+ e.data.port.postMessage({result: result});
+ });
+ });
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/unregister.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698