| Index: LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html
|
| diff --git a/LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html b/LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fa98d0a3d15ae12a492aa474221be691e5b1bc0b
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/local/serviceworker/resources/fetch-request-body-file-iframe.html
|
| @@ -0,0 +1,53 @@
|
| +<script>
|
| +var port = undefined;
|
| +var scope = 'fetch-request-body-file-test';
|
| +var script = 'fetch-request-body-file-worker.js';
|
| +
|
| +window.addEventListener('message', function(evt) {
|
| + port = evt.ports[0];
|
| + start();
|
| + }, false);
|
| +
|
| +function wait_for_update(registration) {
|
| + return new Promise(function(resolve) {
|
| + registration.addEventListener('updatefound', function() {
|
| + resolve(registration.installing);
|
| + });
|
| + });
|
| +}
|
| +
|
| +function wait_for_activated(worker) {
|
| + return new Promise(function(resolve) {
|
| + worker.addEventListener('statechange', function() {
|
| + if (worker.state == 'activated') {
|
| + resolve(worker);
|
| + }
|
| + });
|
| + });
|
| +}
|
| +
|
| +function start() {
|
| + if (location.search == '?register') {
|
| + navigator.serviceWorker.register(script, {scope: scope})
|
| + .then(function(registration) {
|
| + return registration.unregister();
|
| + })
|
| + .then(function() {
|
| + return navigator.serviceWorker.register(script, {scope: scope});
|
| + })
|
| + .then(wait_for_update)
|
| + .then(wait_for_activated)
|
| + .then(function(worker) {
|
| + port.postMessage({msg: 'registered'});
|
| + });
|
| + } else if (location.search == '?unregister') {
|
| + navigator.serviceWorker.register(script, {scope: scope})
|
| + .then(function(registration) {
|
| + return registration.unregister();
|
| + })
|
| + .then(function() {
|
| + port.postMessage({msg: 'unregistered'});
|
| + });
|
| + }
|
| +}
|
| +</script>
|
|
|