Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 test(function () { | |
| 27 try { | |
| 28 history.pushState(null, null, orginURL + "?hash"); | |
| 29 done(); | |
| 30 } catch (e) { | |
| 31 assert_unreached("pushState ?hash should not fail."); | |
| 32 } | |
| 33 }, 'pushState ?hash in unique origin should not fail with SecurityError'); | |
|
Mike West
2016/06/16 09:23:13
Nit: Newlines, as above.
Peng Xinchao
2016/06/17 11:09:52
Done.
| |
| 34 test(function () { | |
| 35 try { | |
| 36 history.pushState(null, null, orginURL + "?hash#base"); | |
| 37 done(); | |
| 38 } catch (e) { | |
| 39 assert_unreached("pushState ?hash#base should not fail."); | |
| 40 } | |
| 41 }, 'pushState ?hash#base in unique origin should not fail with SecurityError'); | |
| 25 </script> | 42 </script> |
| OLD | NEW |