Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Move Ms2ger's XHR tests into position. #52

Merged
merged 1 commit into from

2 participants

@Ms2ger
Collaborator

No description provided.

@darobin
Owner

This doesn't apply because of the manifest — care to update?

@Ms2ger Ms2ger merged commit f4075ca into master
@Ms2ger Ms2ger deleted the submission/Ms2ger/XHR branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 12, 2014
  1. @Ms2ger
This page is out of date. Refresh to see the latest.
View
28 XMLHttpRequest/FormData-append.html
@@ -0,0 +1,28 @@
+<!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>
+function test_formdata(creator, verifier, description) {
+ async_test(description).step(function() {
+ var fd = creator();
+ var xhr = new XMLHttpRequest();
+ xhr.onload = this.step_func(function() {
+ verifier(xhr.responseText);
+ this.done();
+ });
+ xhr.open("POST", "resources/upload.py");
+ xhr.send(fd);
+ })
+}
+test_formdata(function() {
+ var fd = new FormData();
+ fd.append("name", new String("value"));
+ return fd;
+}, function(data) {
+ assert_equals(data, "name=value,\n");
+}, "Passing a String object to FormData.append should work.");
+</script>
View
138 XMLHttpRequest/MANIFEST
@@ -1,138 +0,0 @@
-abort-after-send.htm
-abort-during-done.htm
-abort-during-open.htm
-abort-during-unsent.htm
-abort-event-abort.htm
-abort-event-listeners.htm
-abort-event-loadend.htm
-abort-event-order.htm
-abort-upload-event-abort.htm
-abort-upload-event-loadend.htm
-dir support
-getallresponseheaders-cookies.htm
-getallresponseheaders-status.htm
-getresponseheader-case-insensitive.htm
-getresponseheader-cookies-and-more.htm
-getresponseheader-server-date.htm
-getresponseheader-special-characters.htm
-getresponseheader-unsent-opened-state.htm
-open-after-abort.htm
-open-during-abort.htm
-open-method-bogus.htm
-open-method-case-insensitive.htm
-open-method-case-sensitive.htm
-open-method-insecure.htm
-open-open-send.htm
-open-open-sync-send.htm
-open-send-open.htm
-open-sync-open-send.htm
-open-url-about-blank-window.htm
-open-url-base-inserted-after-open.htm
-open-url-base-inserted.htm
-open-url-base.htm
-open-url-bogus.htm
-open-url-encoding.htm
-open-url-fragment.htm
-open-url-javascript-window-2.htm
-open-url-javascript-window.htm
-open-url-multi-window-2.htm
-open-url-multi-window-3.htm
-open-url-multi-window-4.htm
-open-url-multi-window-5.htm
-open-url-multi-window.htm
-open-user-password-non-same-origin.htm
-overridemimetype-done-state.htm
-overridemimetype-headers-received-state-force-shiftjis.htm
-overridemimetype-invalid-mime-type.htm
-overridemimetype-loading-state.htm
-overridemimetype-open-state-force-utf-8.htm
-overridemimetype-open-state-force-xml.htm
-overridemimetype-unsent-state-force-shiftjis.htm
-response-data-arraybuffer.htm
-response-data-blob.htm
-responsetext-decoding.htm
-responsexml-basic.htm
-responsexml-media-type.htm
-responsexml-non-well-formed.htm
-send-accept-language.htm
-send-accept.htm
-send-authentication.htm
-send-conditional.htm
-send-content-type-charset.htm
-send-content-type-string.htm
-send-data-arraybuffer.htm
-send-data-blob.htm
-send-data-formdata.htm
-send-entity-body-basic.htm
-send-entity-body-document-bogus.htm
-send-entity-body-document.htm
-send-entity-body-empty.htm
-send-entity-body-get-head.htm
-send-entity-body-none-explicit.htm
-send-entity-body-none.htm
-send-network-error-async-events.htm
-send-network-error-sync-events.htm
-send-no-response-event-loadend.htm
-send-no-response-event-loadstart.htm
-send-no-response-event-order.htm
-send-non-same-origin.htm
-send-redirect-bogus-sync.htm
-send-redirect-bogus.htm
-send-redirect-no-location.htm
-send-redirect.htm
-send-response-event-load.htm
-send-response-event-loadend.htm
-send-response-event-loadstart.htm
-send-response-event-order.htm
-send-response-event-progress.htm
-send-response-upload-event-loadend.htm
-send-response-upload-event-loadstart.htm
-send-response-upload-event-progress.htm
-send-send.htm
-send-sync-no-response-event-load.htm
-send-sync-no-response-event-loadend.htm
-send-sync-no-response-event-order.htm
-send-sync-response-event-order.htm
-send-sync-timeout.htm
-send-timeout-events.htm
-setrequestheader-after-send.htm
-setrequestheader-bogus-header.htm
-setrequestheader-bogus-name.htm
-setrequestheader-bogus-value.htm
-setrequestheader-case-insensitive.htm
-setrequestheader-header-allowed.htm
-setrequestheader-header-forbidden.htm
-status-async.htm
-status-basic.htm
-status-error.htm
-support xmlhttprequest-timeout-aborted.js
-support xmlhttprequest-timeout-abortedonmain.js
-support xmlhttprequest-timeout-overrides.js
-support xmlhttprequest-timeout-overridesexpires.js
-support xmlhttprequest-timeout-runner.js
-support xmlhttprequest-timeout-simple.js
-support xmlhttprequest-timeout-synconmain.js
-support xmlhttprequest-timeout-synconworker.js
-support xmlhttprequest-timeout-twice.js
-support xmlhttprequest-timeout.js
-xmlhttprequest-basic.htm
-xmlhttprequest-eventtarget.htm
-xmlhttprequest-network-error-sync.htm
-xmlhttprequest-network-error.htm
-xmlhttprequest-timeout-aborted.html
-xmlhttprequest-timeout-abortedonmain.html
-xmlhttprequest-timeout-overrides.html
-xmlhttprequest-timeout-overridesexpires.html
-xmlhttprequest-timeout-simple.html
-xmlhttprequest-timeout-synconmain.html
-xmlhttprequest-timeout-twice.html
-xmlhttprequest-timeout-worker-aborted.html
-xmlhttprequest-timeout-worker-overrides.html
-xmlhttprequest-timeout-worker-overridesexpires.html
-xmlhttprequest-timeout-worker-simple.html
-xmlhttprequest-timeout-worker-synconworker.html
-xmlhttprequest-timeout-worker-twice.html
-xmlhttprequest-unsent.htm
-manual send-authentication-existing-session-interactive.htm
-manual send-authentication-prompt-interactive.htm
-manual send-authentication-prompt-interactive-2.htm
View
116 XMLHttpRequest/interfaces.html
@@ -0,0 +1,116 @@
+<!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>
+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 class=untested>
+[TreatNonCallableAsNull]
+callback EventHandlerNonNull = any (Event event);
+typedef EventHandlerNonNull? EventHandler;
+</script>
+<script type=text/plain>
+[NoInterfaceObject]
+interface XMLHttpRequestEventTarget : EventTarget {
+ // event handlers
+ attribute EventHandler onloadstart;
+ attribute EventHandler onprogress;
+ attribute EventHandler onabort;
+ attribute EventHandler onerror;
+ attribute EventHandler onload;
+ attribute EventHandler ontimeout;
+ attribute EventHandler onloadend;
+};
+
+interface XMLHttpRequestUpload : XMLHttpRequestEventTarget {
+};
+
+enum XMLHttpRequestResponseType {
+ "",
+ "arraybuffer",
+ "blob",
+ "document",
+ "json",
+ "text"
+};
+
+[Constructor]
+interface XMLHttpRequest : XMLHttpRequestEventTarget {
+ // event handler
+ attribute EventHandler 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(ByteString method, /*[EnsureUTF16]*/ DOMString url);
+ void open(ByteString method, /*[EnsureUTF16]*/ DOMString url, boolean async, optional /*[EnsureUTF16]*/ DOMString? username = null, optional /*[EnsureUTF16]*/ DOMString? password = null);
+ void setRequestHeader(ByteString name, ByteString value);
+ attribute unsigned long timeout;
+ attribute boolean withCredentials;
+ readonly attribute XMLHttpRequestUpload upload;
+ void send(optional (ArrayBufferView or Blob or Document or /*[EnsureUTF16]*/ DOMString or FormData or URLSearchParams)? data = null);
+ void abort();
+
+ // response
+ readonly attribute unsigned short status;
+ readonly attribute ByteString statusText;
+ ByteString? getResponseHeader(ByteString name);
+ ByteString getAllResponseHeaders();
+ void overrideMimeType(DOMString mime);
+ attribute XMLHttpRequestResponseType responseType;
+ readonly attribute any response;
+ readonly attribute DOMString responseText;
+ readonly attribute Document? responseXML;
+};
+
+interface FormData {
+ void append(/*[EnsureUTF16]*/ DOMString name, Blob value, optional /*[EnsureUTF16]*/ DOMString filename);
+ void append(/*[EnsureUTF16]*/ DOMString name, /*[EnsureUTF16]*/ DOMString value);
+ void delete(/*[EnsureUTF16]*/ DOMString name);
+ FormDataEntryValue? get(/*[EnsureUTF16]*/ DOMString name);
+ sequence<FormDataEntryValue> getAll(/*[EnsureUTF16]*/ DOMString name);
+ boolean has(/*[EnsureUTF16]*/ DOMString name);
+ void set(/*[EnsureUTF16]*/ DOMString name, Blob value, optional /*[EnsureUTF16]*/ DOMString filename);
+ void set(/*[EnsureUTF16]*/ DOMString name, /*[EnsureUTF16]*/ DOMString value);
+};
+</script>
+<script>
+"use strict";
+var form;
+var idlArray;
+setup(function() {
+ form = document.createElement("form");
+ 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>
View
1  XMLHttpRequest/resources/upload.py
@@ -1,6 +1,5 @@
def main(request, response):
content = []
- print request.POST
for key, values in sorted(item for item in request.POST.items() if not hasattr(item[1][0], "filename")):
content.append("%s=%s," % (key, values[0]))
View
13 ...ons/Ms2ger/setrequestheader-invalid-arguments.htm → ...ttpRequest/setrequestheader-invalid-arguments.htm
@@ -23,19 +23,20 @@
<script>
var invalid_headers = ["(", ")", "<", ">", "@", ",", ";", ":", "\\",
"\"", "/", "[", "]", "?", "=", "{", "}", " ",
- "\u0009", "\u007f"]
+ /* HT already tested in the loop below */
+ "\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() {
+ assert_throws("SyntaxError", function() {
var client = new XMLHttpRequest()
- client.open("GET", "../resources/delay.php?ms=0")
+ client.open("GET", "../common/text-plain.txt")
client.setRequestHeader(invalid_headers[i], "test")
- }, "setRequestHeader should throw with header " +
- format_value(invalid_headers[i]) +".")
- })
+ })
+ }, "setRequestHeader should throw with header " +
+ format_value(invalid_headers[i]) + ".")
}
</script>
</body>
View
14 XMLHttpRequest/tests/submissions/Ms2ger/FormData-append.html
@@ -1,14 +0,0 @@
-<!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>
View
3  XMLHttpRequest/tests/submissions/Ms2ger/MANIFEST
@@ -1,3 +0,0 @@
-FormData-append.html
-interfaces.html
-setrequestheader-invalid-arguments.htm
View
105 XMLHttpRequest/tests/submissions/Ms2ger/interfaces.html
@@ -1,105 +0,0 @@
-<!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>
-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>
View
2  XMLHttpRequest/tests/submissions/Ms2ger/manifest.txt
@@ -1,2 +0,0 @@
-interfaces.html
-setrequestheader-invalid-arguments.htm XMLHttpRequest: setRequestHeader() with invalid arguments
Something went wrong with that request. Please try again.