dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!doctype html>
michael@0 2 <meta charset=utf-8>
michael@0 3 <title>XMLHttpRequest IDL tests</title>
michael@0 4 <div id=log></div>
michael@0 5 <script src=/resources/testharness.js></script>
michael@0 6 <script src=/resources/testharnessreport.js></script>
michael@0 7 <script src=/resources/WebIDLParser.js></script>
michael@0 8 <script src=/resources/idlharness.js></script>
michael@0 9 <script type=text/plain class=untested>
michael@0 10 interface EventTarget {
michael@0 11 void addEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
michael@0 12 void removeEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
michael@0 13 boolean dispatchEvent(Event event);
michael@0 14 };
michael@0 15 </script>
michael@0 16 <script type=text/plain>
michael@0 17 [NoInterfaceObject]
michael@0 18 interface XMLHttpRequestEventTarget : EventTarget {
michael@0 19 // event handlers
michael@0 20 [TreatNonCallableAsNull] attribute Function? onloadstart;
michael@0 21 [TreatNonCallableAsNull] attribute Function? onprogress;
michael@0 22 [TreatNonCallableAsNull] attribute Function? onabort;
michael@0 23 [TreatNonCallableAsNull] attribute Function? onerror;
michael@0 24 [TreatNonCallableAsNull] attribute Function? onload;
michael@0 25 [TreatNonCallableAsNull] attribute Function? ontimeout;
michael@0 26 [TreatNonCallableAsNull] attribute Function? onloadend;
michael@0 27 };
michael@0 28
michael@0 29 interface XMLHttpRequestUpload : XMLHttpRequestEventTarget {
michael@0 30
michael@0 31 };
michael@0 32
michael@0 33 /*
michael@0 34 enum XMLHttpRequestResponseType {
michael@0 35 "",
michael@0 36 "arraybuffer",
michael@0 37 "blob",
michael@0 38 "document",
michael@0 39 "json",
michael@0 40 "text"
michael@0 41 };
michael@0 42 */
michael@0 43
michael@0 44 [Constructor]
michael@0 45 interface XMLHttpRequest : XMLHttpRequestEventTarget {
michael@0 46 // event handler
michael@0 47 [TreatNonCallableAsNull] attribute Function? onreadystatechange;
michael@0 48
michael@0 49 // states
michael@0 50 const unsigned short UNSENT = 0;
michael@0 51 const unsigned short OPENED = 1;
michael@0 52 const unsigned short HEADERS_RECEIVED = 2;
michael@0 53 const unsigned short LOADING = 3;
michael@0 54 const unsigned short DONE = 4;
michael@0 55 readonly attribute unsigned short readyState;
michael@0 56
michael@0 57 // request
michael@0 58 void open(DOMString method, DOMString url, optional boolean async/* = true*/, optional DOMString? user, optional DOMString? password);
michael@0 59 void setRequestHeader(DOMString header, DOMString value);
michael@0 60 attribute unsigned long timeout;
michael@0 61 attribute boolean withCredentials;
michael@0 62 readonly attribute XMLHttpRequestUpload upload;
michael@0 63 void send(optional (ArrayBufferView or Blob or Document or DOMString or FormData)? data/* = null*/);
michael@0 64 void abort();
michael@0 65
michael@0 66 // response
michael@0 67 readonly attribute unsigned short status;
michael@0 68 readonly attribute DOMString statusText;
michael@0 69 DOMString? getResponseHeader(DOMString header);
michael@0 70 DOMString getAllResponseHeaders();
michael@0 71 void overrideMimeType(DOMString mime);
michael@0 72 /* attribute XMLHttpRequestResponseType responseType; */
michael@0 73 readonly attribute any response;
michael@0 74 readonly attribute DOMString responseText;
michael@0 75 readonly attribute Document? responseXML;
michael@0 76 };
michael@0 77
michael@0 78 [Constructor,
michael@0 79 Constructor(HTMLFormElement form)]
michael@0 80 interface FormData {
michael@0 81 void append(DOMString name, Blob value, optional DOMString filename);
michael@0 82 void append(DOMString name, DOMString value);
michael@0 83 };
michael@0 84 </script>
michael@0 85 <script>
michael@0 86 "use strict";
michael@0 87 var form = document.createElement("form");
michael@0 88 var idlArray = new IdlArray();
michael@0 89 [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
michael@0 90 if (node.className == "untested") {
michael@0 91 idlArray.add_untested_idls(node.textContent);
michael@0 92 } else {
michael@0 93 idlArray.add_idls(node.textContent);
michael@0 94 }
michael@0 95 });
michael@0 96 idlArray.add_objects({
michael@0 97 XMLHttpRequest: ['new XMLHttpRequest()'],
michael@0 98 XMLHttpRequestUpload: ['(new XMLHttpRequest()).upload'],
michael@0 99 FormData: ['new FormData()', 'new FormData(form)']
michael@0 100 });
michael@0 101 idlArray.test();
michael@0 102 </script>

mercurial