summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/update-claim-worker.py
blob: 64914a9dfe5f13d7ae0f6b97ce8d18a5b46c30b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()