| OLD | NEW |
| (Empty) | |
| 1 <?php |
| 2 // Force the browser to cache this script. update() should always bypass this |
| 3 // cache and fetch a new version. |
| 4 header('Cache-Control: max-age=86400'); |
| 5 |
| 6 // Return a different script for each access. |
| 7 header('Content-Type:application/javascript'); |
| 8 echo '// ' . microtime(); |
| 9 ?> |
| 10 |
| 11 importScripts('../../resources/test-helpers.js'); |
| 12 importScripts('../../resources/worker-testharness.js'); |
| 13 |
| 14 var events_seen = []; |
| 15 |
| 16 self.registration.addEventListener('updatefound', function() { |
| 17 events_seen.push('updatefound'); |
| 18 }); |
| 19 |
| 20 self.addEventListener('activate', function(e) { |
| 21 events_seen.push('activate'); |
| 22 }); |
| 23 |
| 24 self.addEventListener('fetch', function(e) { |
| 25 events_seen.push('fetch'); |
| 26 e.respondWith(new Response(events_seen)); |
| 27 }); |
| 28 |
| 29 self.addEventListener('message', function(e) { |
| 30 events_seen.push('message'); |
| 31 self.registration.update(); |
| 32 }); |
| 33 |
| 34 // update() during the script evaluation should be ignored. |
| 35 self.registration.update(); |
| OLD | NEW |