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