Index: third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-whitelisted-auth-denied.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-whitelisted-auth-denied.html b/third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-whitelisted-auth-denied.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a1c46f8be046fdeeb5b3ce69e0464f920264cec9 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-whitelisted-auth-denied.html |
@@ -0,0 +1,19 @@ |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script> |
+test(function () { |
+ testRunner.addOriginAccessWhitelistEntry(location.origin, location.protocol, '', false); |
+}, 'testRunner.addOriginAccessWhitelistEntry is required for this test'); |
+ |
+test(function () { |
+ // http://username@password:localhost:8000/... should be blocked. |
+ var originWithAuth = new URL(document.URL); |
+ originWithAuth.username += 'username'; |
+ originWithAuth.password += 'password'; |
+ originWithAuth = originWithAuth.href; |
+ |
+ assert_throws('SecurityError', function () { |
+ history.pushState(null, null, originWithAuth); |
+ }); |
+}, 'pushState that changes credentials should fail with SecurityError (even with whitelisted origins)'); |
+</script> |