| Index: LayoutTests/http/tests/serviceworker/chromium/resources/sandboxed-iframe-fetch-event-iframe.html
|
| diff --git a/LayoutTests/http/tests/serviceworker/chromium/resources/sandboxed-iframe-fetch-event-iframe.html b/LayoutTests/http/tests/serviceworker/chromium/resources/sandboxed-iframe-fetch-event-iframe.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ac99a02fae585b85c20e1837d0111cec981eff23
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/serviceworker/chromium/resources/sandboxed-iframe-fetch-event-iframe.html
|
| @@ -0,0 +1,42 @@
|
| +<script>
|
| +function with_iframe(url) {
|
| + return new Promise(function(resolve) {
|
| + var frame = document.createElement('iframe');
|
| + frame.src = url;
|
| + frame.onload = function() { resolve(frame); };
|
| + document.body.appendChild(frame);
|
| + });
|
| +}
|
| +
|
| +function with_sandboxed_iframe(url, sandbox) {
|
| + return new Promise(function(resolve) {
|
| + var frame = document.createElement('iframe');
|
| + frame.sandbox = sandbox;
|
| + frame.src = url;
|
| + frame.onload = function() { resolve(frame); };
|
| + document.body.appendChild(frame);
|
| + });
|
| +}
|
| +
|
| +window.onmessage = function (e) {
|
| + var id = e.data['id'];
|
| + fetch(location.href + "_fetch", {mode: 'no-cors'})
|
| + .then(function() {
|
| + return with_iframe(location.href + "_iframe");
|
| + })
|
| + .then(function() {
|
| + return with_sandboxed_iframe(location.href + "_script",
|
| + "allow-scripts");
|
| + })
|
| + .then(function() {
|
| + return with_sandboxed_iframe(location.href + "_script-origin",
|
| + "allow-scripts allow-same-origin");
|
| + })
|
| + .then(function() {
|
| + window.top.postMessage({id: id, result: 'done'}, '*');
|
| + })
|
| + .catch(function(e) {
|
| + window.top.postMessage({id: id, result: 'error: ' + e.toString()}, '*');
|
| + });
|
| +};
|
| +</script>
|
|
|