Skip to content

Commit

Permalink
Prevent sandboxed documents from reusing the default window
Browse files Browse the repository at this point in the history
Bug: 377995
Change-Id: Iff66c6d214dfd0cb7ea9c80f83afeedfff703541
  • Loading branch information
andypaicu authored and chromium-wpt-export-bot committed May 23, 2018
1 parent 7f56040 commit bf7cc00
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 1 deletion.
Expand Up @@ -16,7 +16,7 @@
}
</script>

<iframe src="support/sandboxed-post-message-to-parent.sub.html?sandbox=allow-scripts"></iframe>
<iframe src="support/sandboxed-post-message-to-parent.html?sandbox=allow-scripts"></iframe>
</body>

</html>
@@ -0,0 +1,3 @@
<script>
window.opener.postMessage(window.testProperty, "*");
</script>
@@ -0,0 +1,3 @@
<script>
window.opener.postMessage(window.testProperty, "*");
</script>
22 changes: 22 additions & 0 deletions content-security-policy/sandbox/window-reuse-sandboxed.html
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>

<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>

<body>
<script>
var t = async_test("Window object should not be reused");

window.onmessage = t.step_func_done(function(e) {
assert_equals(e.data, undefined);
});

w = window.open("support/sandboxed-post-property-to-opener.html?sandbox=allow-scripts","","width=400,height=400");
w.testProperty = "test";
</script>
</body>

</html>
22 changes: 22 additions & 0 deletions content-security-policy/sandbox/window-reuse-unsandboxed.html
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>

<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>

<body>
<script>
var t = async_test("Window object should be reused");

window.onmessage = t.step_func_done(function(e) {
assert_equals(e.data, "test");
});

w = window.open("support/unsandboxed-post-property-to-opener.html","","width=400,height=400");
w.testProperty = "test";
</script>
</body>

</html>

0 comments on commit bf7cc00

Please sign in to comment.