summaryrefslogtreecommitdiffstats
path: root/dom/imptests/webapps/XMLHttpRequest/tests
diff options
context:
space:
mode:
Diffstat (limited to 'dom/imptests/webapps/XMLHttpRequest/tests')
-rw-r--r--dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_FormData-append.html14
-rw-r--r--dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html102
-rw-r--r--dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_setrequestheader-invalid-arguments.htm42
3 files changed, 158 insertions, 0 deletions
diff --git a/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_FormData-append.html b/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_FormData-append.html
new file mode 100644
index 000000000..b05c5169b
--- /dev/null
+++ b/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_FormData-append.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>FormData.append</title>
+<link rel=help href=http://xhr.spec.whatwg.org/#dom-formdata-append>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id=log></div>
+<script>
+test(function() {
+ var fd = new FormData();
+ fd.append("name", new String("value"));
+ // TODO: test that it actually worked.
+}, "Passing a String object to FormData.append should work.");
+</script>
diff --git a/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html b/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html
new file mode 100644
index 000000000..165d013d2
--- /dev/null
+++ b/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_interfaces.html
@@ -0,0 +1,102 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>XMLHttpRequest IDL tests</title>
+<div id=log></div>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=/resources/WebIDLParser.js></script>
+<script src=/resources/idlharness.js></script>
+<script type=text/plain class=untested>
+interface EventTarget {
+ void addEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
+ void removeEventListener(DOMString type, EventListener? callback, optional boolean capture /* = false */);
+ boolean dispatchEvent(Event event);
+};
+</script>
+<script type=text/plain>
+[NoInterfaceObject]
+interface XMLHttpRequestEventTarget : EventTarget {
+ // event handlers
+ [TreatNonCallableAsNull] attribute Function? onloadstart;
+ [TreatNonCallableAsNull] attribute Function? onprogress;
+ [TreatNonCallableAsNull] attribute Function? onabort;
+ [TreatNonCallableAsNull] attribute Function? onerror;
+ [TreatNonCallableAsNull] attribute Function? onload;
+ [TreatNonCallableAsNull] attribute Function? ontimeout;
+ [TreatNonCallableAsNull] attribute Function? onloadend;
+};
+
+interface XMLHttpRequestUpload : XMLHttpRequestEventTarget {
+
+};
+
+/*
+enum XMLHttpRequestResponseType {
+ "",
+ "arraybuffer",
+ "blob",
+ "document",
+ "json",
+ "text"
+};
+*/
+
+[Constructor]
+interface XMLHttpRequest : XMLHttpRequestEventTarget {
+ // event handler
+ [TreatNonCallableAsNull] attribute Function? onreadystatechange;
+
+ // states
+ const unsigned short UNSENT = 0;
+ const unsigned short OPENED = 1;
+ const unsigned short HEADERS_RECEIVED = 2;
+ const unsigned short LOADING = 3;
+ const unsigned short DONE = 4;
+ readonly attribute unsigned short readyState;
+
+ // request
+ void open(DOMString method, DOMString url, optional boolean async/* = true*/, optional DOMString? user, optional DOMString? password);
+ void setRequestHeader(DOMString header, DOMString value);
+ attribute unsigned long timeout;
+ attribute boolean withCredentials;
+ readonly attribute XMLHttpRequestUpload upload;
+ void send(optional (ArrayBufferView or Blob or Document or DOMString or FormData)? data/* = null*/);
+ void abort();
+
+ // response
+ readonly attribute unsigned short status;
+ readonly attribute DOMString statusText;
+ DOMString? getResponseHeader(DOMString header);
+ DOMString getAllResponseHeaders();
+ void overrideMimeType(DOMString mime);
+/* attribute XMLHttpRequestResponseType responseType; */
+ readonly attribute any response;
+ readonly attribute DOMString responseText;
+ readonly attribute Document? responseXML;
+};
+
+[Constructor,
+ Constructor(HTMLFormElement form)]
+interface FormData {
+ void append(DOMString name, Blob value, optional DOMString filename);
+ void append(DOMString name, DOMString value);
+};
+</script>
+<script>
+"use strict";
+var form = document.createElement("form");
+var idlArray = new IdlArray();
+[].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
+ if (node.className == "untested") {
+ idlArray.add_untested_idls(node.textContent);
+ } else {
+ idlArray.add_idls(node.textContent);
+ }
+});
+idlArray.add_objects({
+ XMLHttpRequest: ['new XMLHttpRequest()'],
+ XMLHttpRequestUpload: ['(new XMLHttpRequest()).upload'],
+ FormData: ['new FormData()', 'new FormData(form)']
+});
+idlArray.test();
+</script>
diff --git a/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_setrequestheader-invalid-arguments.htm b/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_setrequestheader-invalid-arguments.htm
new file mode 100644
index 000000000..a077ad95f
--- /dev/null
+++ b/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/test_setrequestheader-invalid-arguments.htm
@@ -0,0 +1,42 @@
+<!doctype html>
+<html>
+ <head>
+ <title>XMLHttpRequest: setRequestHeader() with invalid arguments</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ </head>
+ <body>
+ <div id="log"></div>
+<!--
+ CHAR = <any US-ASCII character (octets 0 - 127)>
+ CTL = <any US-ASCII control character
+ (octets 0 - 31) and DEL (127)>
+ SP = <US-ASCII SP, space (32)>
+ HT = <US-ASCII HT, horizontal-tab (9)>
+ token = 1*<any CHAR except CTLs or separators>
+ separators = "(" | ")" | "<" | ">" | "@"
+ | "," | ";" | ":" | "\" | <">
+ | "/" | "[" | "]" | "?" | "="
+ | "{" | "}" | SP | HT
+ field-name = token
+-->
+ <script>
+ var invalid_headers = ["(", ")", "<", ">", "@", ",", ";", ":", "\\",
+ "\"", "/", "[", "]", "?", "=", "{", "}", " ",
+ "\u0009", "\u007f"]
+ for (var i = 0; i < 32; ++i) {
+ invalid_headers.push(String.fromCharCode(i))
+ }
+ for (var i = 0; i < invalid_headers.length; ++i) {
+ test(function() {
+ assert_throws("SYNTAX_ERR", function() {
+ var client = new XMLHttpRequest()
+ client.open("GET", "../resources/delay.php?ms=0")
+ client.setRequestHeader(invalid_headers[i], "test")
+ }, "setRequestHeader should throw with header " +
+ format_value(invalid_headers[i]) +".")
+ })
+ }
+ </script>
+ </body>
+</html>