blob: c3a36b786fec2bcc90f8ee4f27e0a377b6f4b9d9 [file] [log] [blame]
<!doctype html>
<html>
<head>
<!-- No 'treat-as-public-address' CSP directive, so we count as internal. -->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./resources/preflight.js"></script>
</head>
<body>
<script>
test(t => { assert_equals(document.addressSpace, "local"); }, "Sanity check: locality.");
async_test(function (t) {
var xhr = new XMLHttpRequest;
xhr.responseType = "json";
xhr.onload = t.step_func_done(function (e) {
assert_equals('success', xhr.response.jsonpResult);
});
xhr.onerror = t.unreached_func("The load should not fail.");
xhr.open("GET", preflightURL('fail-with-500', 'json'), true);
xhr.send();
}, "XHR should pass on preflight with 500 error (because no preflight is sent)");
async_test(function (t) {
var xhr = new XMLHttpRequest;
xhr.responseType = "json";
xhr.onload = t.step_func_done(function (e) {
assert_equals('success', xhr.response.jsonpResult);
});
xhr.onerror = t.unreached_func("The load should not fail.");
xhr.open("GET", preflightURL('fail-without-allow', 'json'), true);
xhr.send();
}, "XHR should pass on preflight without allow (because no preflight is sent)");
async_test(function (t) {
var xhr = new XMLHttpRequest;
xhr.responseType = "json";
xhr.onload = t.step_func_done(function (e) {
assert_equals('success', xhr.response.jsonpResult);
});
xhr.onerror = t.unreached_func("The load should not fail.");
xhr.open("GET", preflightURL('pass', 'json'), true);
xhr.send();
}, "XHR should pass on successful preflight");
</script>
</body>
</html>