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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/navigation/pushstate-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 assert_throws('SecurityError', function () { 9 assert_throws('SecurityError', function () {
9 history.pushState(null, null, document.URL + "/path"); 10 history.pushState(null, null, orginURL + "/path");
10 }); 11 });
11 }, 'pushState to a new path in unique origin should fail with SecurityError'); 12 }, 'pushState to a new path in unique origin should fail with SecurityError');
12 test(function () { 13 test(function () {
13 try { 14 try {
14 history.pushState(null, null, document.URL + "#hash"); 15 history.pushState(null, null, orginURL + "#hash");
15 done(); 16 done();
16 } catch (e) { 17 } catch (e) {
17 assert_unreached("pushState to a new hash should not fail."); 18 assert_unreached("pushState #hash should not fail.");
18 } 19 }
19 }, 'pushState to new hash in unique origin should not fail with SecurityError'); 20 }, 'pushState #hash in unique origin should not fail with SecurityError');
21 test(function () {
22 try {
23 history.pushState(null, null, orginURL + "?hash");
24 done();
25 } catch (e) {
26 assert_unreached("pushState ?hash should not fail.");
27 }
28 }, 'pushState ?hash in unique origin should not fail with SecurityError');
Mike West 2016/06/16 09:23:13 Nit: Can you add a newline between tests? Also abo
Peng Xinchao 2016/06/17 11:09:52 Done.
29 test(function () {
30 try {
31 history.pushState(null, null, orginURL + "?hash#base");
32 done();
33 } catch (e) {
34 assert_unreached("pushState ?hash#base should not fail.");
35 }
36 }, 'pushState ?hash#base in unique origin should not fail with SecurityError');
20 </script> 37 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698