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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/sandbox-DENIED-top-navigation-without-user-gesture.html

Issue 2645733002: Add an 'allow-top-navigation-with-user-interaction' sandbox flag. (Closed)
Patch Set: Fix the tests finally! Created 3 years, 11 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/frameNavigation/sandbox-DENIED-top-navigation-without-user-gesture.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/sandbox-DENIED-top-navigation-without-user-gesture.html b/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/sandbox-DENIED-top-navigation-without-user-gesture.html
new file mode 100644
index 0000000000000000000000000000000000000000..071fdc71448bed07c609c3b5cae174044fbe372a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/frameNavigation/sandbox-DENIED-top-navigation-without-user-gesture.html
@@ -0,0 +1,24 @@
+<html>
+<head>
+<script>
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.dumpChildFramesAsText();
+ testRunner.setDumpConsoleMessages(true);
+ testRunner.waitUntilDone();
+}
+
+window.addEventListener("message", e => {
+ if (e.data == "PASS")
+ testRunner.notifyDone();
+ else
+ testRunner.testFailed("'top.location' didn't throw.");
+});
+</script>
+</head>
+<body>
+ <p>This tests that an iframe in sandbox with 'allow-top-navigation-with-user-activation'
+ cannot navigate its top level page, if it is not trigged by a user gesture.</p>
+ <iframe sandbox='allow-top-navigation-with-user-activation allow-scripts' src="http://localhost:8000/security/frameNavigation/resources/iframe-that-performs-top-navigation-without-user-gesture-failed.html"></iframe>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698