mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
44 lines
1.3 KiB
HTML
44 lines
1.3 KiB
HTML
<!doctype html>
|
|
<meta charset=utf-8>
|
|
<title>XMLHttpRequest IDL tests</title>
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<script src=/resources/WebIDLParser.js></script>
|
|
<script src=/resources/idlharness.js></script>
|
|
|
|
<h1>XMLHttpRequest IDL tests</h1>
|
|
<div id=log></div>
|
|
|
|
<script type=text/plain class=untested>
|
|
[TreatNonCallableAsNull]
|
|
callback EventHandlerNonNull = any (Event event);
|
|
typedef EventHandlerNonNull? EventHandler;
|
|
</script>
|
|
<script>
|
|
"use strict";
|
|
var form = document.createElement("form");
|
|
var idlArray = new IdlArray();
|
|
|
|
function doTest([domIdl, xhrIdl]) {
|
|
idlArray.add_untested_idls(domIdl);
|
|
var untestedIdl = document.querySelector("script.untested").textContent;
|
|
idlArray.add_untested_idls(untestedIdl);
|
|
idlArray.add_idls(xhrIdl);
|
|
idlArray.add_objects({
|
|
XMLHttpRequest: ['new XMLHttpRequest()'],
|
|
XMLHttpRequestUpload: ['(new XMLHttpRequest()).upload'],
|
|
FormData: ['new FormData()', 'new FormData(form)']
|
|
});
|
|
idlArray.test();
|
|
}
|
|
|
|
function fetchText(url) {
|
|
return fetch(url).then(response => response.text());
|
|
}
|
|
|
|
promise_test(() => {
|
|
return Promise.all(["/interfaces/dom.idl",
|
|
"/interfaces/xhr.idl"].map(fetchText))
|
|
.then(doTest);
|
|
}, "Test driver");
|
|
</script>
|