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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-in-page-navigation.php

Issue 2472963002: Suborigins should not crash fragment navigations. (Closed)
Patch Set: history.pushState Created 4 years, 1 month 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
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-in-page-navigation.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-in-page-navigation.php b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-in-page-navigation.php
new file mode 100644
index 0000000000000000000000000000000000000000..1ae4b4b6b9fded5358ecabc3fed9528ef01679f6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/suborigin-in-page-navigation.php
@@ -0,0 +1,38 @@
+<?php
+ header("Suborigin: foo");
+?>
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body>
+<a id="bar"></a>
+<script>
+ window.onload = _ => {
+ async_test(t => {
+ history.pushState({"name": "value"}, "navigation", "foo.html");
+ history.pushState({"name": "value"}, "navigation", "bar.html");
+ assert_equals(window.location.href, "http://127.0.0.1:8000/security/suborigins/bar.html");
+
+ window.addEventListener("popstate", t.step_func(e => {
+ if (e.state) {
+ assert_equals(window.location.href, "http://127.0.0.1:8000/security/suborigins/foo.html");
+ assert_equals(e.state.name, "value");
+ t.done();
+ }
+ }));
+
+ history.back();
+ }, "History state manipulation is allowed in suborigins.");
+
+ async_test(t => {
+ var original = window.location.href;
+ window.location.hash = "bar";
+ assert_equals(window.location.href, original + "#bar");
+
+ window.addEventListener("hashchange", t.step_func_done(e => {
+ assert_equals(e.newURL, original + "#bar");
+ }));
+ }, "Hash navigations are allowed in suborigins.");
+ };
+</script>
+</body>
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698