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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html

Issue 2371993003: Throw when blocking top-level navigation. (Closed)
Patch Set: Test. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html b/third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html
new file mode 100644
index 0000000000000000000000000000000000000000..7248e8740204adece4fd2e1e6fbfbb9b9615f0e4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/sandbox-iframe-blocks-top-navigation.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ async_test(t => {
+ window.addEventListener("message", t.step_func_done(e => {
+ assert_equals(e.data.name, 'SecurityError', 'Should throw a security error.');
+ assert_equals(e.data.location, 'about:srcdoc', 'Exception is same-origin with the embedee.');
+ }));
+ }, "Sandboxed frames should throw when navigating the top-level window.");
+</script>
+<iframe sandbox="allow-scripts"
+ srcdoc="<script>
+ try {
+ top.location = '/security/frameNavigation/resources/fail.html';
+ top.postMessage('No Exception', '*');
+ } catch (e) {
+ top.postMessage({
+ 'name': e.name,
+ 'location': e.constructor.constructor('return location.href')()
+ }, '*');
+ }
+ </script>"></iframe>

Powered by Google App Engine
This is Rietveld 408576698