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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-whitelisted-at-unique-origin-denied.php

Issue 2060093002: Allow 'history.pushState' to modify query string for unique and file origins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow 'history.pushState' to modify query string for unique and file origins. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 <?php 1 <?php
2 header("Content-Security-Policy: sandbox allow-scripts"); 2 header("Content-Security-Policy: sandbox allow-scripts");
3 ?> 3 ?>
4 <script src="../resources/testharness.js"></script> 4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script> 5 <script src="../resources/testharnessreport.js"></script>
6 <script> 6 <script>
7 var orginURL = document.URL;
7 test(function () { 8 test(function () {
8 testRunner.addOriginAccessWhitelistEntry(location.origin, location.protocol, '', false); 9 testRunner.addOriginAccessWhitelistEntry(location.origin, location.protocol, '', false);
9 }, 'testRunner.addOriginAccessWhitelistEntry is required for this test'); 10 }, 'testRunner.addOriginAccessWhitelistEntry is required for this test');
10 11
11 test(function () { 12 test(function () {
12 assert_throws('SecurityError', function () { 13 assert_throws('SecurityError', function () {
13 history.pushState(null, null, document.URL + "/path"); 14 history.pushState(null, null, orginURL + "/path");
14 }); 15 });
15 }, 'pushState at unique origin should fail with SecurityError (even with whiteli sted origins)'); 16 }, 'pushState at unique origin should fail with SecurityError (even with whiteli sted origins)');
16 17
17 test(function () { 18 test(function () {
18 try { 19 try {
19 history.pushState(null, null, document.URL + "#hash"); 20 history.pushState(null, null, orginURL + "#hash");
20 done(); 21 done();
21 } catch (e) { 22 } catch (e) {
22 assert_unreached("pushState to a new hash should not fail."); 23 assert_unreached("pushState #hash should not fail.");
23 } 24 }
24 }, 'pushState to new hash in unique origin should not fail with SecurityError'); 25 }, 'pushState #hash in unique origin should not fail with SecurityError');
26
27 test(function () {
28 try {
29 history.pushState(null, null, orginURL + "?hash");
30 done();
31 } catch (e) {
32 assert_unreached("pushState ?hash should not fail.");
33 }
34 }, 'pushState ?hash in unique origin should not fail with SecurityError');
35
36 test(function () {
37 try {
38 history.pushState(null, null, orginURL + "?hash#base");
39 done();
40 } catch (e) {
41 assert_unreached("pushState ?hash#base should not fail.");
42 }
43 }, 'pushState ?hash#base in unique origin should not fail with SecurityError');
25 </script> 44 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698