summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/cache-storage/resources/common-worker.js
blob: d0e8544b56c2677a9c60d47a9e8b587d63bc6d6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
self.onmessage = function(e) {
    var cache_name = e.data.name;

    self.caches.open(cache_name)
        .then(function(cache) {
            return Promise.all([
                cache.put('https://example.com/a', new Response('a')),
                cache.put('https://example.com/b', new Response('b')),
                cache.put('https://example.com/c', new Response('c'))
            ]);
        })
        .then(function() {
            self.postMessage('ok');
        });
};