Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: LayoutTests/http/tests/serviceworker/chromium/resources/sandboxed-iframe-fetch-event-iframe.html

Issue 1208693003: Add LayoutTest for ServiceWorker's sandbox iframe handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use in Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/chromium/resources/sandboxed-iframe-fetch-event-worker.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <script>
2 function with_iframe(url) {
3 return new Promise(function(resolve) {
4 var frame = document.createElement('iframe');
5 frame.src = url;
6 frame.onload = function() { resolve(frame); };
7 document.body.appendChild(frame);
8 });
9 }
10
11 function with_sandboxed_iframe(url, sandbox) {
12 return new Promise(function(resolve) {
13 var frame = document.createElement('iframe');
14 frame.sandbox = sandbox;
15 frame.src = url;
16 frame.onload = function() { resolve(frame); };
17 document.body.appendChild(frame);
18 });
19 }
20
21 window.onmessage = function (e) {
22 var id = e.data['id'];
23 fetch(location.href + "_fetch", {mode: 'no-cors'})
24 .then(function() {
25 return with_iframe(location.href + "_iframe");
26 })
27 .then(function() {
28 return with_sandboxed_iframe(location.href + "_script",
29 "allow-scripts");
30 })
31 .then(function() {
32 return with_sandboxed_iframe(location.href + "_script-origin",
33 "allow-scripts allow-same-origin");
34 })
35 .then(function() {
36 window.top.postMessage({id: id, result: 'done'}, '*');
37 })
38 .catch(function(e) {
39 window.top.postMessage({id: id, result: 'error: ' + e.toString()}, '*');
40 });
41 };
42 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/serviceworker/chromium/resources/sandboxed-iframe-fetch-event-worker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698