3 // See ServiceWorkerBrowserTest ImportsBustMemcache.
4 // Content-Shell data persists so unregister first to clear old data.
5 // Register, unregister, then reregister. The browsertest examines the
6 // state of the scriptcache to ensure the script and import are cached.
8 var scope = 'imports_bust_memcache_scope/';
9 var script = 'worker_with_one_import.js';
11 navigator.serviceWorker.getRegistration(scope)
12 .then(function(registration) {
14 return registration.unregister();
17 console.log('initial unregistration done');
18 return navigator.serviceWorker.register(script, {scope: scope});
20 .then(function(registration) {
21 console.log('initial registration done');
22 return registration.unregister();
25 console.log('unregistration done');
26 return navigator.serviceWorker.register(script, {scope: scope});
29 console.log('second registration done');
30 document.title = 'OK'; // Titlewatcher looks for this.
33 document.title = 'FAILED';