summaryrefslogtreecommitdiffstats
path: root/test/wpt/tests/service-workers/service-worker/resources/update-claim-worker.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/wpt/tests/service-workers/service-worker/resources/update-claim-worker.py')
-rw-r--r--test/wpt/tests/service-workers/service-worker/resources/update-claim-worker.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/wpt/tests/service-workers/service-worker/resources/update-claim-worker.py b/test/wpt/tests/service-workers/service-worker/resources/update-claim-worker.py
new file mode 100644
index 0000000..64914a9
--- /dev/null
+++ b/test/wpt/tests/service-workers/service-worker/resources/update-claim-worker.py
@@ -0,0 +1,24 @@
+import time
+
+script = u'''
+// Time stamp: %s
+// (This ensures the source text is *not* a byte-for-byte match with any
+// previously-fetched version of this script.)
+
+// This no-op fetch handler is necessary to bypass explicitly the no fetch
+// handler optimization by which this service worker script can be skipped.
+addEventListener('fetch', event => {
+ return;
+ });
+
+addEventListener('install', event => {
+ event.waitUntil(self.skipWaiting());
+ });
+
+addEventListener('activate', event => {
+ event.waitUntil(self.clients.claim());
+ });'''
+
+
+def main(request, response):
+ return [(b'Content-Type', b'application/javascript')], script % time.time()