OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <title>register</title> | 2 <title>register, unregister, and report result to opener</title> |
3 <script src="test-helpers.js"></script> | |
4 <body> | 3 <body> |
5 <script> | 4 <script> |
| 5 'use strict'; |
| 6 |
6 navigator.serviceWorker.register('empty-worker.js', {scope: 'scope-register'}) | 7 navigator.serviceWorker.register('empty-worker.js', {scope: 'scope-register'}) |
7 .then( | 8 .then( |
8 registration => { | 9 registration => { |
9 registration.unregister().then(() => { | 10 registration.unregister().then(() => { |
10 window.parent.postMessage('OK', '*'); | 11 window.opener.postMessage('OK', '*'); |
11 }); | 12 }); |
12 }, | 13 }, |
13 error => { | 14 error => { |
14 window.parent.postMessage('FAIL: ' + error.name, '*'); | 15 window.opener.postMessage('FAIL: ' + error.name, '*'); |
15 }) | 16 }) |
16 .catch(error => { | 17 .catch(error => { |
17 window.parent.postMessage('ERROR: ' + error.name, '*'); | 18 window.opener.postMessage('ERROR: ' + error.name, '*'); |
18 }); | 19 }); |
19 </script> | 20 </script> |
20 </body> | 21 </body> |
OLD | NEW |