gecko-dev/dom/xhr/tests/test_nestedSyncXHR.html
Brian Grinstead 0d460e3432 Bug 1544322 - Part 2.2 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in dom/ r=bzbarsky
This is split from the previous changeset since if we include dom/ the file size is too
large for phabricator to handle.

This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 2` argument.

Differential Revision: https://phabricator.services.mozilla.com/D27457

--HG--
extra : moz-landing-system : lando
2019-04-16 03:53:28 +00:00

102 lines
2.3 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for sync XHR into sync XHRs</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript">
let xhr = new XMLHttpRequest();
let testCompleted = false;
let frame = document.createElement('frame');
frame.addEventListener('load', function() {
if (testCompleted) {
return;
}
try {
xhr.responseType = "blob";
ok(false, "xhr.responseType cannot be settable");
} catch(e) {
ok(true, "xhr.responseType cannot be settable");
}
try {
xhr.abort();
ok(false, "xhr.abort should throw");
} catch(e) {
ok(true, "xhr.abort should throw");
}
try {
xhr.getAllResponseHeaders();
ok(false, "xhr.getAllResponseHeaders should throw");
} catch(e) {
ok(true, "xhr.getAllResponseHeaders should throw");
}
try {
xhr.getResponseHeader("foo");
ok(false, "xhr.getResponseHeader should throw");
} catch(e) {
ok(true, "xhr.getResponseHeader should throw");
}
try {
xhr.open('POST', location, false);
ok(false, "xhr.open should throw");
} catch(e) {
ok(true, "xhr.open should throw");
}
try {
xhr.send();
ok(false, "xhr.send should throw");
} catch(e) {
ok(true, "xhr.send should throw");
}
try {
xhr.timeout = 42;
ok(false, "xhr.timeout cannot be settable");
} catch(e) {
ok(true, "xhr.timeout cannot be settable");
}
try {
xhr.withCredentials = false;
ok(false, "xhr.withCredentials cannot be settable");
} catch(e) {
ok(true, "xhr.withCredentials cannot be settable");
}
try {
xhr.overrideMimeType("wow")
ok(false, "xhr.overrideMimeType should throw");
} catch(e) {
ok(true, "xhr.overrideMimeType should throw");
}
}, { once: true });
// This test is racy because we try to check that the loading of the frame
// happens during a sync XHR. If the loading happens after, we still need to
// consider the test passed.
ok(xhr, "We have an XHR.");
document.documentElement.appendChild(frame);
xhr.open('POST', location, false);
xhr.send('X');
// Nothing can guarantee that the frame is loaded during the sync XHR.
testCompleted = true;
frame.remove();
</script>
</body>
</html>