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 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> |
| OLD | NEW |