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'); |
| 13 |
12 test(function () { | 14 test(function () { |
13 try { | 15 try { |
14 history.pushState(null, null, document.URL + "#hash"); | 16 history.pushState(null, null, orginURL + "#hash"); |
15 done(); | 17 done(); |
16 } catch (e) { | 18 } catch (e) { |
17 assert_unreached("pushState to a new hash should not fail."); | 19 assert_unreached("pushState #hash should not fail."); |
18 } | 20 } |
19 }, 'pushState to new hash in unique origin should not fail with SecurityError'); | 21 }, 'pushState #hash in unique origin should not fail with SecurityError'); |
| 22 |
| 23 test(function () { |
| 24 try { |
| 25 history.pushState(null, null, orginURL + "?hash"); |
| 26 done(); |
| 27 } catch (e) { |
| 28 assert_unreached("pushState ?hash should not fail."); |
| 29 } |
| 30 }, 'pushState ?hash in unique origin should not fail with SecurityError'); |
| 31 |
| 32 test(function () { |
| 33 try { |
| 34 history.pushState(null, null, orginURL + "?hash#base"); |
| 35 done(); |
| 36 } catch (e) { |
| 37 assert_unreached("pushState ?hash#base should not fail."); |
| 38 } |
| 39 }, 'pushState ?hash#base in unique origin should not fail with SecurityError'); |
20 </script> | 40 </script> |
OLD | NEW |