Index: third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..cbe70304d89c3835663d6ab9782a44482134af7c |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/service-workers/service-worker/resources/mint-new-worker.py |
@@ -0,0 +1,25 @@ |
+import time |
+ |
+body = ''' |
+onactivate = (e) => e.waitUntil(clients.claim()); |
+var resolve_wait_until; |
+var wait_until = new Promise(resolve => { |
+ resolve_wait_until = resolve; |
+ }); |
+onmessage = (e) => { |
+ if (e.data == 'wait') |
+ e.waitUntil(wait_until); |
+ if (e.data == 'go') |
+ resolve_wait_until(); |
+ };''' |
+ |
+def main(request, response): |
+ headers = [('Cache-Control', 'no-cache, must-revalidate'), |
+ ('Pragma', 'no-cache'), |
+ ('Content-Type', 'application/javascript')] |
+ |
+ skipWaiting = '' |
+ if 'skip-waiting' in request.GET: |
+ skipWaiting = 'skipWaiting();' |
+ |
+ return headers, '/* %s %s */ %s %s' % (time.time(), time.clock(), skipWaiting, body) |