blob: 6dbcdff5444450460f77162cfeb55b0b9aa7ee32 [file] [log] [blame]
<?php
header("Content-Security-Policy: sandbox allow-scripts");
?>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
var orginURL = document.URL;
test(function () {
assert_throws_dom('SecurityError', function () {
history.pushState(null, null, orginURL + "/path");
});
}, 'pushState to a new path in unique origin should fail with SecurityError');
test(function () {
try {
history.pushState(null, null, orginURL + "#hash");
done();
} catch (e) {
assert_unreached("pushState #hash should not fail.");
}
}, 'pushState #hash in unique origin should not fail with SecurityError');
test(function () {
try {
history.pushState(null, null, orginURL + "?hash");
done();
} catch (e) {
assert_unreached("pushState ?hash should not fail.");
}
}, 'pushState ?hash in unique origin should not fail with SecurityError');
test(function () {
try {
history.pushState(null, null, orginURL + "?hash#base");
done();
} catch (e) {
assert_unreached("pushState ?hash#base should not fail.");
}
}, 'pushState ?hash#base in unique origin should not fail with SecurityError');
</script>