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..e7afc70ebdebf4c0b17ec7e4957f7be3578b2490 |
--- /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'}, '*'); |
+ }, |
+ function() { |
nhiroki
2015/06/26 01:01:36
Why don't you use 'catch'?
horo
2015/06/26 03:59:10
Done.
|
+ window.top.postMessage({id: id, result: 'error'}, '*'); |
+ }); |
+}; |
+</script> |