| #!/usr/bin/env python3 |
| |
| import sys |
| |
| sys.stdout.write( |
| 'Content-Security-Policy: sandbox allow-scripts\r\n' |
| 'Content-Type: text/html\r\n\r\n' |
| '<script src="../resources/testharness.js"></script>\n' |
| '<script src="../resources/testharnessreport.js"></script>\n' |
| '<script>\n' |
| 'var originURL = document.URL;\n' |
| 'test(function () {\n' |
| ' assert_throws_dom(\'SecurityError\', function () {\n' |
| ' history.pushState(null, null, originURL + "/path");\n' |
| ' });\n' |
| '}, \'pushState to a new path in unique origin should fail with SecurityError\');\n' |
| '\n' |
| 'test(function () {\n' |
| ' try {\n' |
| ' history.pushState(null, null, originURL + "#hash");\n' |
| ' done();\n' |
| ' } catch (e) {\n' |
| ' assert_unreached("pushState #hash should not fail.");\n' |
| ' }\n' |
| '}, \'pushState #hash in unique origin should not fail with SecurityError\');\n' |
| '\n' |
| 'test(function () {\n' |
| ' try {\n' |
| ' history.pushState(null, null, originURL + "?query");\n' |
| ' done();\n' |
| ' } catch (e) {\n' |
| ' assert_unreached("pushState ?query should not fail.");\n' |
| ' }\n' |
| '}, \'pushState ?query in unique origin should not fail with SecurityError\');\n' |
| '\n' |
| 'test(function () {\n' |
| ' try {\n' |
| ' history.pushState(null, null, originURL + "?query#hash");\n' |
| ' done();\n' |
| ' } catch (e) {\n' |
| ' assert_unreached("pushState ?query#hash should not fail.");\n' |
| ' }\n' |
| '}, \'pushState ?query#hash in unique origin should not fail with SecurityError\');\n' |
| '</script>\n' |
| ) |