+2017-11-08 Ms2ger <Ms2ger@igalia.com>
+
+ Update XMLHttpRequest tests.
+ https://bugs.webkit.org/show_bug.cgi?id=179421
+
+ Reviewed by Sam Weinig.
+
+ * TestExpectations: removed flaky expectation: the test was fixed upstream.
+
2017-11-07 Ryan Haddad <ryanhaddad@apple.com>
Update TestExpectations for slow WPT encoding LayoutTests.
webkit.org/b/168175 imported/w3c/web-platform-tests/html/browsers/offline/browser-state/navigator_online_online.html [ Pass Failure ]
webkit.org/b/169264 imported/w3c/web-platform-tests/html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-navigation-samedoc.html [ Failure ]
-imported/w3c/web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm [ Failure Pass ]
imported/w3c/web-platform-tests/cssom/MediaList.html [ Failure ]
imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/document-adopt-base-url.html [ ImageOnlyFailure ]
+2017-11-08 Ms2ger <Ms2ger@igalia.com>
+
+ Update XMLHttpRequest tests.
+ https://bugs.webkit.org/show_bug.cgi?id=179421
+
+ Reviewed by Sam Weinig.
+
+ * resources/import-expectations.json: enabled some more tests
+ * web-platform-tests/XMLHttpRequest/abort-during-done.htm:
+ * web-platform-tests/XMLHttpRequest/abort-during-headers-received.htm:
+ * web-platform-tests/XMLHttpRequest/abort-during-loading.htm:
+ * web-platform-tests/XMLHttpRequest/open-after-abort.htm:
+ * web-platform-tests/XMLHttpRequest/open-url-multi-window-2-expected.txt:
+ * web-platform-tests/XMLHttpRequest/open-url-multi-window-2.htm:
+ * web-platform-tests/XMLHttpRequest/open-url-multi-window-3-expected.txt:
+ * web-platform-tests/XMLHttpRequest/open-url-multi-window-3.htm:
+ * web-platform-tests/XMLHttpRequest/open-url-multi-window-4.htm:
+ * web-platform-tests/XMLHttpRequest/open-url-multi-window-6.htm:
+ * web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin-expected.txt:
+ * web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm:
+ * web-platform-tests/XMLHttpRequest/open-url-worker-origin-expected.txt: Added.
+ * web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm: Added.
+ * web-platform-tests/XMLHttpRequest/overridemimetype-open-state-force-xml.htm:
+ * web-platform-tests/XMLHttpRequest/resources/workerxhr-origin-referrer.js:
+ * web-platform-tests/XMLHttpRequest/resources/workerxhr-simple.js:
+ * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-simple.js:
+ * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-synconmain.js:
+ * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-synconworker.js:
+ * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout-twice.js:
+ * web-platform-tests/XMLHttpRequest/resources/xmlhttprequest-timeout.js:
+ * web-platform-tests/XMLHttpRequest/responsedocument-decoding.htm:
+ * web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt: Added.
+ * web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm: Added.
+ * web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args-expected.txt: Added.
+ * web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm: Added.
+ * web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm: Added.
+ * web-platform-tests/XMLHttpRequest/send-authentication-basic.htm: Added.
+ * web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords-expected.txt: Added.
+ * web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm: Added.
+ * web-platform-tests/XMLHttpRequest/send-entity-body-basic-expected.txt: Added.
+ * web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm: Added.
+ * web-platform-tests/XMLHttpRequest/send-entity-body-document-expected.txt:
+ * web-platform-tests/XMLHttpRequest/send-entity-body-document.htm:
+ * web-platform-tests/XMLHttpRequest/send-entity-body-get-head-async.htm:
+ * web-platform-tests/XMLHttpRequest/send-entity-body-get-head.htm:
+ * web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub-expected.txt: Added.
+ * web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm: Added.
+ * web-platform-tests/XMLHttpRequest/send-redirect-infinite.htm:
+ * web-platform-tests/XMLHttpRequest/send-redirect-no-location.htm:
+ * web-platform-tests/XMLHttpRequest/send-redirect-post-upload.htm:
+ * web-platform-tests/XMLHttpRequest/setrequestheader-after-send.htm:
+ * web-platform-tests/XMLHttpRequest/setrequestheader-before-open.htm:
+ * web-platform-tests/XMLHttpRequest/w3c-import.log:
+ * web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-reused.html:
+ * web-platform-tests/XMLHttpRequest/xmlhttprequest-unsent.htm:
+
2017-11-07 Brady Eidson <beidson@apple.com>
Implement "UpdateWorkerState" and use it
"web-platform-tests/XMLHttpRequest": "import",
"web-platform-tests/XMLHttpRequest/abort-after-stop.htm": "skip",
"web-platform-tests/XMLHttpRequest/event-error-order.sub.html": "skip",
- "web-platform-tests/XMLHttpRequest/event-error.html": "skip",
"web-platform-tests/XMLHttpRequest/event-timeout-order.htm": "skip",
- "web-platform-tests/XMLHttpRequest/event-upload-progress-crossorigin.sub.htm": "skip",
- "web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm": "skip",
"web-platform-tests/XMLHttpRequest/preserve-ua-header-on-redirect.htm": "skip",
"web-platform-tests/XMLHttpRequest/send-after-setting-document-domain.htm": "skip",
"web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm": "skip",
- "web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm": "skip",
- "web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm": "skip",
"web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader-existing-session.htm": "skip",
- "web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm": "skip",
- "web-platform-tests/XMLHttpRequest/send-authentication-basic.htm": "skip",
- "web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm": "skip",
- "web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm": "skip",
- "web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm": "skip",
"web-platform-tests/accelerometer": "skip",
"web-platform-tests/ambient-light": "skip",
"web-platform-tests/animation-timing": "skip",
assert_equals(client.statusText, "")
assert_equals(client.responseXML, null)
assert_equals(client.getAllResponseHeaders(), "")
- setTimeout(function() {
+ test.step_timeout(function() {
assert_array_equals(result, expected)
test.done();
}, 100); // wait a bit in case XHR timeout causes spurious event
assert_equals(client.statusText, "")
assert_equals(client.responseXML, null)
assert_equals(client.getAllResponseHeaders(), "")
- setTimeout(function() {
+ test.step_timeout(function() {
assert_array_equals(result, expected)
test.done();
}, 100); // wait a bit in case XHR timeout causes spurious event
assert_equals(client.statusText, "")
assert_equals(client.responseXML, null)
assert_equals(client.getAllResponseHeaders(), "")
- setTimeout(function() {
+ test.step_timeout(function() {
assert_array_equals(result, expected)
test.done();
}, 100); // wait a bit in case XHR timeout causes spurious event
</script>
</body>
</html>
-
test.step(function() {
var client = new XMLHttpRequest(),
result = [],
- expected = [1, 4, 1] // open() -> 1,
+ expected = [1, 4, 1] // open() -> 1,
// abort() -> 4, open() -> 1
client.onreadystatechange = function() {
test.step(function() {
-FAIL XMLHttpRequest: open() resolving URLs (multi-Window; 2; evil) assert_throws: open() when associated document's IFRAME is removed function "function () {
- client.open("GET", "folder.txt")
+FAIL XMLHttpRequest: open() resolving URLs (multi-Window; 2; evil) assert_throws: open() when associated document's IFRAME is removed function "function () {
+ client.open("GET", "folder.txt")
}" did not throw
test(function() {
var client = new self[0].XMLHttpRequest()
document.body.removeChild(document.getElementsByTagName("iframe")[0])
- assert_throws("InvalidStateError", function() {
- client.open("GET", "folder.txt")
+ assert_throws("InvalidStateError", function() {
+ client.open("GET", "folder.txt")
}, "open() when associated document's IFRAME is removed")
})
}
-FAIL XMLHttpRequest: open() resolving URLs (multi-Window; 3; evil) assert_throws: send() when associated document's IFRAME is removed function "function () {
+FAIL XMLHttpRequest: open() resolving URLs (multi-Window; 3; evil) assert_throws: send() when associated document's IFRAME is removed function "function () {
client.send(null)
}" did not throw
var client = new self[0].XMLHttpRequest()
client.open("GET", "folder.txt")
document.body.removeChild(document.getElementsByTagName("iframe")[0])
- assert_throws("InvalidStateError", function() {
+ assert_throws("InvalidStateError", function() {
client.send(null)
}, "send() when associated document's IFRAME is removed")
})
/*
It's unclear what the pass condition should be for this test.
Implementations:
- Firefox, Opera (Presto): terminate request with no further events when IFRAME is removed.
+ Firefox, Opera (Presto): terminate request with no further events when IFRAME is removed.
Chrome: completes request to readyState=4 but responseText is "" so it's pretty much terminated with an extra event for "DONE" state
Pass condition is now according to my suggested spec text in https://github.com/whatwg/xhr/pull/3 , if that's not accepted we'll have to amend this test
*/
test.step(function() {
var hasErrorEvent = false
var client = new self[0].XMLHttpRequest()
- client.onreadystatechange = function() {
+ client.onreadystatechange = function() {
test.step(function() {
if(client.readyState == 4) {
assert_equals(client.responseText, "", "responseText is empty on inactive document error condition")
ifr.onload = function() {
// Again, do things async so we're not doing loads from inside
// load events.
- setTimeout(function() {
+ test.step_timeout(function() {
client = new ifr.contentWindow.XMLHttpRequest();
count++;
// Important to do a normal navigation, not a reload.
Blocked access to external URL http://www2.localhost:8800/XMLHttpRequest/resources/inspect-headers.py?filter_name=origin&cors
-PASS XMLHttpRequest: redirected worker scripts, origin and referrer
-FAIL Origin header assert_equals: expected "Origin: http://localhost:8800\n" but got ""
FAIL Referer header assert_equals: expected "Referer: http://localhost:8800/XMLHttpRequest/resources/workerxhr-origin-referrer.js\n" but got "Referer: http://localhost:8800/XMLHttpRequest/resources/redirect.py?location=workerxhr-origin-referrer.js\n"
+FAIL Origin header assert_equals: expected "Origin: http://localhost:8800\n" but got ""
PASS Request URL test
- <!DOCTYPE html>
-<html>
-<head>
- <meta charset="utf-8" />
- <title>XMLHttpRequest: redirected worker scripts, origin and referrer</title>
- <script src="/resources/testharness.js"></script>
- <script src="/resources/testharnessreport.js"></script>
-</head>
-<body>
- <div id="log"></div>
- <script type="text/javascript">
- var test = async_test() // This "test" does not actually do any assertations. It's just there to have multiple, separate, asyncronous sub-tests.
- var expectations = {
- 'Referer header': 'Referer: '+(location.href.replace(/[^/]*$/, ''))+"resources/workerxhr-origin-referrer.js\n",
- 'Origin header': 'Origin: '+location.protocol+'//'+location.hostname+((location.port === "")?"":":"+location.port)+'\n',
- 'Request URL test' : (location.href.replace(/[^/]*$/, ''))+'resources/requri.py?full'
- }
- // now start the worker
- var finalWorkerURL = "workerxhr-origin-referrer.js";
- var url = "resources/redirect.py?location=" + encodeURIComponent(finalWorkerURL);
- var worker = new Worker(url)
- worker.onmessage = function (e) {
- var subtest = async_test(e.data.test)
- subtest.step(function(){
- var thisExpectation = expectations[e.data.test]
- delete expectations[e.data.test]
- assert_equals(e.data.result, thisExpectation)
- subtest.done()
- })
- var allDone = true
- for(var prop in expectations){
- allDone = false
- }
- if(allDone){
- test.step(function(){
- test.done()
- })
- }
- }
-
- </script>
-</body>
-</html>
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>XMLHttpRequest: redirected worker scripts, origin and referrer</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+var finalWorkerURL = "workerxhr-origin-referrer.js";
+var url = "resources/redirect.py?location=" + encodeURIComponent(finalWorkerURL);
+fetch_tests_from_worker(new Worker(url));
+</script>
--- /dev/null
+Blocked access to external URL http://www2.localhost:8800/XMLHttpRequest/resources/inspect-headers.py?filter_name=origin&cors
+
+PASS Referer header
+FAIL Origin header assert_equals: expected "Origin: http://localhost:8800\n" but got ""
+PASS Request URL test
+
--- /dev/null
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>XMLHttpRequest: worker scripts, origin and referrer</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+fetch_tests_from_worker(new Worker("resources/workerxhr-origin-referrer.js"));
+</script>
var client = new XMLHttpRequest();
client.onreadystatechange = function() {
if (client.readyState !== 4) return;
- try{
+ try{
var str = client.responseXML.documentElement.tagName+client.responseXML.documentElement.firstChild.tagName+client.responseXML.documentElement.firstChild.textContent;
- }catch(e){
- assert_unreached('Exception when reading responseXML');
- }
+ }catch(e){
+ assert_unreached('Exception when reading responseXML');
+ }
assert_equals( client.responseXML.documentElement.tagName, 'test' );
assert_equals( client.responseXML.documentElement.firstChild.tagName, 'message' );
assert_equals( client.responseXML.documentElement.firstChild.textContent, 'Hello WorldοΌ' );
-// This simply posts a message to the owner page with the contents of the Referer header
-var xhr=new XMLHttpRequest()
-xhr.onreadystatechange = function(){
- if(xhr.readyState == 4){
- var obj = {test:'Referer header', result:xhr.responseText}
- self.postMessage(obj)
+importScripts("/resources/testharness.js")
+
+async_test(function() {
+ var expected = 'Referer: ' +
+ location.href.replace(/[^/]*$/, '') +
+ "workerxhr-origin-referrer.js\n"
+
+ var xhr = new XMLHttpRequest()
+ xhr.onreadystatechange = this.step_func(function() {
+ if (xhr.readyState == 4) {
+ assert_equals(xhr.responseText, expected)
+ this.done()
}
-}
-xhr.open('GET', 'inspect-headers.py?filter_name=referer', true)
-xhr.send()
-
-// This simply posts a message to the owner page with the contents of the Origin header
-var xhr2=new XMLHttpRequest()
-xhr2.onreadystatechange = function(){
- if(xhr2.readyState == 4){
- var obj = {test:'Origin header', result:xhr2.responseText}
- self.postMessage(obj)
+ })
+ xhr.open('GET', 'inspect-headers.py?filter_name=referer', true)
+ xhr.send()
+}, 'Referer header')
+
+async_test(function() {
+ var expected = 'Origin: ' +
+ location.protocol +
+ '//' +
+ location.hostname +
+ (location.port === "" ? "" : ":" + location.port) +
+ '\n'
+
+ var xhr = new XMLHttpRequest()
+ xhr.onreadystatechange = this.step_func(function() {
+ if (xhr.readyState == 4) {
+ assert_equals(xhr.responseText, expected)
+ this.done()
}
-}
-xhr2.open('GET', location.protocol + '//www2.'+location.hostname+((location.port === "")?"":":"+location.port)+(location.pathname.replace(/[^/]*$/, ''))+'inspect-headers.py?filter_name=origin&cors', true)
-xhr2.send()
-
-// If "origin" / base URL is the origin of this JS file, we can load files
-// from the server it originates from.. and requri.py will be able to tell us
-// what the requested URL was
-var xhr3=new XMLHttpRequest()
-xhr3.onreadystatechange = function(){
- if(xhr3.readyState == 4){
- var obj = {test:'Request URL test', result:xhr3.responseText}
- self.postMessage(obj)
+ })
+ var url = location.protocol +
+ '//www2.' +
+ location.hostname +
+ (location.port === "" ? "" : ":" + location.port) +
+ location.pathname.replace(/[^/]*$/, '') +
+ 'inspect-headers.py?filter_name=origin&cors'
+ xhr.open('GET', url, true)
+ xhr.send()
+}, 'Origin header')
+
+async_test(function() {
+ // If "origin" / base URL is the origin of this JS file, we can load files
+ // from the server it originates from.. and requri.py will be able to tell us
+ // what the requested URL was
+
+ var expected = location.href.replace(/[^/]*$/, '') +
+ 'requri.py?full'
+
+ var xhr = new XMLHttpRequest()
+ xhr.onreadystatechange = this.step_func(function() {
+ if (xhr.readyState == 4) {
+ assert_equals(xhr.responseText, expected)
+ this.done()
}
-}
-xhr3.open('GET', 'requri.py?full', true)
-xhr3.send()
+ })
+ xhr.open('GET', 'requri.py?full', true)
+ xhr.send()
+}, 'Request URL test')
+
+done()
-
var xhr=new XMLHttpRequest()
xhr.onreadystatechange = function(){
- if(xhr.readyState == 4){
- var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED'
- self.postMessage(status)
- }
+ if(xhr.readyState == 4){
+ var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED'
+ self.postMessage(status)
+ }
}
xhr.open('GET', 'folder.txt', true)
xhr.send()
importScripts("xmlhttprequest-timeout.js");
runTestRequests([ new RequestTracker(true, "no time out scheduled, load fires normally", 0),
- new RequestTracker(true, "load fires normally", TIME_NORMAL_LOAD),
- new RequestTracker(true, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
+ new RequestTracker(true, "load fires normally", TIME_NORMAL_LOAD),
+ new RequestTracker(true, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
runTestRequests([ SyncRequestSettingTimeoutAfterOpen,
- SyncRequestSettingTimeoutBeforeOpen ]);
+ SyncRequestSettingTimeoutBeforeOpen ]);
if (this.document === undefined){
importScripts("xmlhttprequest-timeout.js");
}else{
- throw "This test expects to be run as a Worker";
+ throw "This test expects to be run as a Worker";
}
/* NOT TESTED: setting timeout before calling open( ... , false) in a worker context. The test code always calls open() first. */
runTestRequests([ new RequestTracker(false, "no time out scheduled, load fires normally", 0),
- new RequestTracker(false, "load fires normally", TIME_NORMAL_LOAD),
- new RequestTracker(false, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
+ new RequestTracker(false, "load fires normally", TIME_NORMAL_LOAD),
+ new RequestTracker(false, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
importScripts("xmlhttprequest-timeout.js");
runTestRequests([ new RequestTracker(true, "load fires normally with no timeout set, twice", 0, TIME_REGULAR_TIMEOUT, 0),
- new RequestTracker(true, "load fires normally with same timeout set twice", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD),
- new RequestTracker(true, "timeout fires normally with same timeout set twice", TIME_REGULAR_TIMEOUT, TIME_DELAY, TIME_REGULAR_TIMEOUT) ]);
+ new RequestTracker(true, "load fires normally with same timeout set twice", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD),
+ new RequestTracker(true, "timeout fires normally with same timeout set twice", TIME_REGULAR_TIMEOUT, TIME_DELAY, TIME_REGULAR_TIMEOUT) ]);
/**
* Check the event received, and if it's the right (and only) one we get.
*
- * WebKit fires abort events even for DONE and UNSENT states, which is
+ * WebKit fires abort events even for DONE and UNSENT states, which is
* discussed in http://webkit.org/b/98404
* That's why we chose to accept secondary "abort" events in this test.
*
}
const encoded_content = "%e6%a9%9f";
- const encoded_xml =
+ const encoded_xml =
encodeURIComponent("<?xml version='1.0' encoding='windows-1252'?><x>") + encoded_content + encodeURIComponent("<\/x>");
const encoded_html =
encodeURIComponent("<!doctype html><meta charset=windows-1252><x>") + encoded_content + encodeURIComponent("<\/x>");
--- /dev/null
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://www1.localhost:8800/XMLHttpRequest/resources/auth1/corsenabled.py due to access control checks.
+
+PASS XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure)
+
--- /dev/null
+<!doctype html>
+<html>
+ <head>
+ <title>XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure)</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var test = async_test()
+ test.step(function() {
+ var client = new XMLHttpRequest(),
+ urlstart = 'www1.'+location.host + location.pathname.replace(/\/[^\/]*$/, '/')
+ client.withCredentials = true
+ client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/corsenabled.py", true, 'user', 'pass')
+ client.setRequestHeader("x-user", 'user')
+ client.setRequestHeader("x-pass", 'pass')
+ client.onreadystatechange = function(){
+ if (client.readyState === 4) {
+ test.step(function(){
+ assert_equals(client.responseText, '')
+ assert_equals(client.status, 0)
+ assert_equals(client.getResponseHeader('x-challenge'), null)
+ test.done()
+ })
+ }
+ }
+ client.send(null)
+ }, document.title)
+ </script>
+ </body>
+</html>
--- /dev/null
+
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open() in first request, without in second
+
--- /dev/null
+<!doctype html>
+<html>
+ <head>
+ <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open() in first request, without in second</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function() {
+ var client = new XMLHttpRequest(),
+ urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
+ user = token()
+ client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass')
+ client.setRequestHeader("x-user", user)
+ client.send(null)
+ // Repeat request but *without* credentials in the open() call.
+ // Is the UA supposed to cache credentials from above request and use them? Yes.
+ client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false)
+ client.setRequestHeader("x-user", user)
+ client.send(null)
+
+ assert_equals(client.responseText, user + "\n" + 'pass')
+ //assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT')
+
+ }, document.title)
+ </script>
+ </body>
+</html>
--- /dev/null
+<!doctype html>
+<html>
+ <head>
+ <title>XMLHttpRequest: send() - "Basic" authenticated request using setRequestHeader()</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <!-- These spec references do not make much sense simply because the spec doesn't say very much about this.. -->
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol[1]/li[6]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ var test = async_test()
+ test.step(function() {
+ var client = new XMLHttpRequest(),
+ urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
+ user = token()
+ client.open("GET", location.protocol+'//'+urlstart + "resources/auth2/auth.py", false)
+ client.setRequestHeader("x-user", user)
+ client.setRequestHeader('Authorization', 'Basic ' + btoa(user + ":pass"))
+ client.onreadystatechange = function () {
+ if (client.readyState < 4) {return}
+ test.step( function () {
+ assert_equals(client.responseText, user + '\npass')
+ assert_equals(client.status, 200)
+ assert_equals(client.getResponseHeader('x-challenge'), 'DID-NOT')
+ test.done()
+ } )
+ }
+ client.send(null)
+ })
+ </script>
+ </body>
+</html>
--- /dev/null
+<!doctype html>
+<html>
+ <head>
+ <title>XMLHttpRequest: send() - "Basic" authenticated requests with user name and password passed to open()</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ test(function() {
+ var client = new XMLHttpRequest(),
+ urlstart = location.host + location.pathname.replace(/\/[^\/]*$/, '/'),
+ user = token();
+ client.open("GET", location.protocol+'//'+urlstart + "resources/auth1/auth.py", false, user, 'pass')
+ client.setRequestHeader("x-user", user)
+ client.send(null)
+ assert_equals(client.responseText, user + "\n" + 'pass')
+ assert_equals(client.getResponseHeader('x-challenge'), 'DID')
+ }, document.title)
+ </script>
+ <p>Note: this test will only work as expected once per browsing session. Restart browser to re-test.</p>
+ </body>
+</html>
--- /dev/null
+
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user/pass in open() call
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options another user/pass in open() call - must override cached credentials from previous test
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user/pass both in URL userinfo AND open() call - expexted that open() wins
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user/pass *only* in URL userinfo
+PASS XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user name in URL userinfo, password in open() call: user name wins and password is thrown away
+FAIL XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options user name and password in URL userinfo, only user name in open() call: user name in open() wins assert_true: responseText should contain the right user and password expected true got false
+
--- /dev/null
+<!doctype html>
+<html>
+ <head>
+ <title>XMLHttpRequest: send() - "Basic" authenticated requests with competing user name/password options</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/utils.js"></script>
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." /> </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ function request(user1, pass1, user2, pass2, name) {
+ // user1, pass1 will if given become userinfo part of URL
+ // user2, pass2 will if given be passed to open() call
+ test(function() {
+ var client = new XMLHttpRequest(),
+ urlstart = "", userwin, passwin
+ // if user2 is set, winning user name and password is 2
+ if(user2)
+ userwin = user2, passwin = pass2
+ // if user1 is set, and user2 is not set, user1 and pass1 win
+ if(user1 && ! user2)
+ userwin = user1, passwin = pass1
+ // if neither user name is set, pass 2 wins (there will be no userinfo in URL)
+ if (!(user1 || user2))
+ passwin = pass2
+ if(user1) { // should add userinfo to URL (there is no way to create userinfo part of URL with only password in)
+ urlstart = "http://" + user1
+ if(pass1)
+ urlstart += ":" + pass1
+ urlstart += "@" + location.host + location.pathname.replace(/\/[^\/]*$/, '/')
+ }
+ client.open("GET", urlstart + "resources/authentication.py", false, user2, pass2)
+ client.setRequestHeader("x-user", userwin)
+ client.send(null)
+ assert_true(client.responseText == ((userwin||'') + "\n" + (passwin||'')), 'responseText should contain the right user and password')
+
+ // We want to send multiple requests to the same realm here, so we try to make the UA forget its (cached) credentials between each test..
+ // forcing a 401 response to (hopefully) "log out"
+ // NOTE: This is commented out because it causes authentication prompts while running the test
+ //client.open('GET', "resources/authentication.py?logout=1", false)
+ //client.send()
+ }, document.title+' '+name)
+ }
+ request(null, null, token(), token(), 'user/pass in open() call')
+ request(null, null, token(), token(), 'another user/pass in open() call - must override cached credentials from previous test')
+ request("userinfo-user", "userinfo-pass", token(), token(), 'user/pass both in URL userinfo AND open() call - expexted that open() wins')
+ request(token(), token(), null, null, 'user/pass *only* in URL userinfo')
+ request(token(), null, null, token(), 'user name in URL userinfo, password in open() call: user name wins and password is thrown away')
+ request("1", token(), token(), null, 'user name and password in URL userinfo, only user name in open() call: user name in open() wins')
+ </script>
+ </body>
+</html>
--- /dev/null
+
+PASS XMLHttpRequest: send() - data argument (1)
+PASS XMLHttpRequest: send() - data argument (10000000)
+PASS XMLHttpRequest: send() - data argument (2,2)
+PASS XMLHttpRequest: send() - data argument (false)
+PASS XMLHttpRequest: send() - data argument (A\0A)
+PASS XMLHttpRequest: send() - data argument (1=2&3=4)
+
--- /dev/null
+<!doctype html>
+<html>
+ <head>
+ <title>XMLHttpRequest: send() - data argument</title>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="/following::ol/li[4]" />
+ </head>
+ <body>
+ <div id="log"></div>
+ <script>
+ function request(input, output) {
+ test(function() {
+ var client = new XMLHttpRequest()
+ client.open("POST", "resources/content.py", false)
+ client.send(input)
+ assert_equals(client.responseText, output)
+ }, document.title + " (" + output + ")")
+ }
+ request(1, "1")
+ request(10000000, "10000000")
+ request([2,2], "2,2")
+ request(false, "false")
+ request("A\0A", "A\0A")
+ request(new URLSearchParams([[1, 2], [3, 4]]), "1=2&3=4")
+ </script>
+ </body>
+</html>
PASS XML document, windows-1252
-PASS image file
-PASS img tag
PASS HTML document, invalid UTF-8
PASS HTML document, shift-jis
-PASS empty div
PASS plain text file
-
+PASS image file
+PASS img tag
+PASS empty div
+
<body>
<div id="log"></div>
<script>
- var expectations = [
- { contentType: 'application/xml;charset=UTF-8', responseText : '<\u00FF\/>' },
- { contentType: 'text/html;charset=UTF-8', responseText : '<body>\uFFFD<\/body>' }, /*invalid character code in document turns into FFFD*/
- { contentType: 'text/html;charset=UTF-8', responseText : '<body>\u30C6\u30b9\u30c8<\/body>' } /* correctly serialized Shift-JIS */,
- { contentType: 'text/html;charset=UTF-8', responseText: 'top' }, /* There's some markup included, but it's not really relevant for this test suite, so we do an indexOf() test */
- { contentType: 'text/html;charset=UTF-8' },
- { contentType: 'text/html;charset=UTF-8', responseText: '<img>foo' },
- { contentType: 'text/html;charset=UTF-8', responseText: '<!DOCTYPE html><html><head></head><body><div></div></body></html>' }
- ]
-
+ var tests = [
+ {
+ title: 'XML document, windows-1252',
+ url: 'resources/win-1252-xml.py',
+ contentType: 'application/xml;charset=UTF-8',
+ responseText: '<\u00FF\/>'
+ },
+ // Invalid character code in document turns into U+FFFD.
+ {
+ title: 'HTML document, invalid UTF-8',
+ url: 'resources/invalid-utf8-html.py',
+ contentType: 'text/html;charset=UTF-8',
+ responseText: '<body>\uFFFD<\/body>'
+ },
+ // Correctly serialized Shift-JIS.
+ {
+ title: 'HTML document, shift-jis',
+ url: 'resources/shift-jis-html.py',
+ contentType: 'text/html;charset=UTF-8',
+ responseText: '<body>\u30C6\u30b9\u30c8<\/body>'
+ },
+ // There's some markup included, but it's not really relevant for this
+ // test suite, so we do an indexOf() test.
+ {
+ title: 'plain text file',
+ url: 'folder.txt',
+ contentType: 'text/html;charset=UTF-8',
+ responseText: 'top'
+ },
+ // This test does not want to assert anything about what markup a
+ // standalone image should be wrapped in. Hence this test lacks a
+ // responseText expectation.
+ {
+ title: 'image file',
+ url: 'resources/image.gif',
+ contentType: 'text/html;charset=UTF-8'
+ },
+ {
+ title: 'img tag',
+ url: 'resources/img-utf8-html.py',
+ contentType: 'text/html;charset=UTF-8',
+ responseText: '<img>foo'
+ },
+ {
+ title: 'empty div',
+ url: 'resources/empty-div-utf8-html.py',
+ contentType: 'text/html;charset=UTF-8',
+ responseText: '<!DOCTYPE html><html><head></head><body><div></div></body></html>'
+ }
+ ];
- function request(input, number, title) {
- test(function() {
+ tests.forEach(function(t) {
+ async_test(function() {
+ var iframe = document.createElement("iframe");
+ iframe.onload = this.step_func_done(function() {
var client = new XMLHttpRequest()
client.open("POST", "resources/content.py?response_charset_label=UTF-8", false)
- client.send(input)
- var exp = expectations[number]
- assert_equals(client.getResponseHeader('X-Request-Content-Type'), exp.contentType, 'document should be serialized and sent as '+exp.contentType+' (TEST#'+number+')')
- // The indexOf() assertation will overlook some stuff, i.e. XML prologues that shouldn't be there (looking at you, Presto).
- // However, arguably these things have little to do with the XHR functionality we're testing.
- if(exp.responseText){ // This test does not want to assert anything about what markup a standalone IMG should be wrapped in. Hence the GIF test lacks a responseText expectation.
- assert_true(client.responseText.indexOf(exp.responseText) != -1,
- JSON.stringify(exp.responseText) + " not in " +
+ client.send(iframe.contentDocument)
+ assert_equals(client.getResponseHeader('X-Request-Content-Type'),
+ t.contentType,
+ 'document should be serialized and sent as ' + t.contentType)
+ // The indexOf() assertion will overlook some stuff, e.g. XML
+ // prologues that shouldn't be there (looking at you, Presto).
+ // However, arguably these things have little to do with the XHR
+ // functionality we're testing.
+ if (t.responseText) {
+ assert_true(client.responseText.indexOf(t.responseText) != -1,
+ JSON.stringify(t.responseText) + " not in " +
JSON.stringify(client.responseText));
}
assert_equals(client.responseXML, null)
- }, title)
- }
- function init(fr, number, title) { request(fr.contentDocument, number, title) }
+ });
+ iframe.src = t.url;
+ document.body.appendChild(iframe);
+ }, t.title);
+ });
</script>
- <!--
- This test also tests how documents in various encodings are serialized.
- The below IFRAMEs contain:
- * one XML document parsed from a windows-1252 source - content is <ΓΏ/>
- * one HTML-document parsed from an invalid UTF-8 source, will contain a basic HTML DOM
- with a U+FFFD replacement character for the invalid char
- * one HTML document parsed from a valid Shift-JIS source
- -->
- <iframe src='resources/win-1252-xml.py' onload="init(this, 0, 'XML document, windows-1252')"></iframe>
- <iframe src='resources/invalid-utf8-html.py' onload="init(this, 1, 'HTML document, invalid UTF-8')"></iframe>
- <iframe src='resources/shift-jis-html.py' onload="init(this, 2, 'HTML document, shift-jis')"></iframe>
- <iframe src='folder.txt' onload="init(this, 3, 'plain text file')"></iframe>
- <iframe src='resources/image.gif' onload="init(this, 4, 'image file')"></iframe>
- <iframe src='resources/img-utf8-html.py' onload="init(this, 5, 'img tag')"></iframe>
- <iframe src='resources/empty-div-utf8-html.py' onload="init(this, 6, 'empty div')"></iframe>
-
</body>
</html>
<title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD - async, no upload events should fire</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7] following::OL[1]/LI[8]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7] following::OL[1]/LI[8]" />
</head>
<body>
<title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7]" />
</head>
<body>
--- /dev/null
+CONSOLE MESSAGE: XMLHttpRequest cannot load http://nonexistent-origin.localhost:8800/ due to access control checks.
+
+PASS XMLHttpRequest: The send() method: Fire a progress event named error when Network error happens (synchronous flag is unset)
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <link rel="help" href="https://xhr.spec.whatwg.org/#handler-xhr-onerror" data-tested-assertations="../.." />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[9]/ol/li[2] following::ol[1]/li[9]/ol/li[3]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[4] following::dd[4]/p" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#network-error" data-tested-assertations=".." />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[6] following::ol[1]/li[7] following::ol[1]/li[7]/ol/li[3] following::ol[1]/li[7]/ol/li[4] following::ol[1]/li[9] following::ol[1]/li[10]" />
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <title>XMLHttpRequest: The send() method: Fire a progress event named error when Network error happens (synchronous flag is unset)</title>
+</head>
+
+<body>
+ <div id="log"></div>
+
+ <script type="text/javascript">
+ var test = async_test();
+
+ test.step(function(){
+ var xhr = new XMLHttpRequest();
+ var expect = ["loadstart", "upload.loadstart", 4, "upload.error", "upload.loadend", "error", "loadend"];
+ var actual = [];
+
+ xhr.onreadystatechange = test.step_func(() => {
+ if (xhr.readyState == 4) {
+ actual.push(xhr.readyState);
+ }
+ });
+
+ xhr.onloadstart = test.step_func(e => { actual.push(e.type); })
+ xhr.onloadend = test.step_func_done(e => {
+ actual.push(e.type);
+ assert_array_equals(actual, expect);
+ })
+ xhr.onerror = test.step_func(e => { actual.push(e.type); })
+
+ xhr.upload.onloadstart = test.step_func(e => { actual.push("upload." + e.type); })
+ xhr.upload.onloadend = test.step_func(e => { actual.push("upload." + e.type); })
+ xhr.upload.onerror = test.step_func(e => { actual.push("upload." + e.type); })
+
+ xhr.open("POST", "http://nonexistent-origin.{{host}}:{{ports[http][0]}}", true);
+ xhr.send("Test Message");
+ });
+ </script>
+</body>
+</html>
test.done()
})
}
- client.send(null)
+ client.send(null)
</script>
</body>
</html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dl[1]/dt[2]" />
- <!--
+ <!--
NOTE: the XHR spec does not really handle this scenario. It's handled in the Fetch spec:
"If response's headers do not contain a header whose name is Location, return response."
-->
// 307 redirects should resend the POST data, and events and headers will be a little different..
if(shouldResendPost) {
- expectedHeaders = {
+ expectedHeaders = {
"X-Request-Content-Length": "11988",
"X-Request-Content-Type": "text/plain;charset=UTF-8",
"X-Request-Method": "POST",
];
} else {
// setting the right expectations for POST resent as GET without request body
- expectedHeaders = {
+ expectedHeaders = {
"X-Request-Content-Length": "NO",
"X-Request-Content-Type": "NO",
"X-Request-Method": "GET",
"X-Request-Query": "NO"
- }
+ }
expectedEvents = [
"xhr onreadystatechange 1",
"xhr loadstart 1",
<title>XMLHttpRequest: setRequestHeader() after send()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[2]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[2]" />
</head>
<body>
<div id="log"></div>
<title>XMLHttpRequest: setRequestHeader() before open()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol/li[1]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol/li[1]" />
</head>
<body>
<div id="log"></div>
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window-6.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-multi-window.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-redirected-worker-origin.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-origin.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-url-worker-simple.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/open-user-password-non-same-origin.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/overridemimetype-blob.html
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/security-consideration.sub.html
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-accept-language.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-accept.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-repeat-no-args.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader-and-arguments.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic-setrequestheader.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-basic.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-competing-names-passwords.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-basic-setrequestheader.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-blob-with-no-mime-type.html
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-data-es-object.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-data-formdata.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-data-unexpected-tostring.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-basic.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-document-bogus.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-empty.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head-async.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-get-head.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-none.htm
+/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-network-error-sync-events.sub.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-no-response-event-loadend.htm
/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-no-response-event-loadstart.htm
<div id="log"></div>
<script type="text/javascript">
+var test = async_test();
+
function startRequest() {
xhr.open("GET", "./resources/content.py?content=Hi", true);
xhr.timeout = 2000;
- setTimeout(function () {
+ test.step_timeout(function () {
xhr.send();
}, 1000);
}
-var test = async_test();
test.step(function()
{
var count = 0;
assert_unreached("HTTP error should not timeout");
}
startRequest();
- setTimeout(startRequest, 3500);
+ test.step_timeout(startRequest, 3500);
});
</script>
<title>XMLHttpRequest: members during UNSENT</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
- <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-unsent" data-tested-assertations=".. following::dd" />
- <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader" data-tested-assertations="following::ol/li[1]" />
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol/li[1]" />
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol/li[1]" />
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-statustext-attribute" data-tested-assertations="following::ol/li[1]" />
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-getresponseheader()-method" data-tested-assertations="following::ol/li[1]" />
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method" data-tested-assertations="following::ol/li[1]" />
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol/li[2]" />
- <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsexml-attribute" data-tested-assertations="following::ol/li[2]" />
-
+ <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-unsent" data-tested-assertations=".. following::dd" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader" data-tested-assertations="following::ol/li[1]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol/li[1]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol/li[1]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-statustext-attribute" data-tested-assertations="following::ol/li[1]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-getresponseheader()-method" data-tested-assertations="following::ol/li[1]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method" data-tested-assertations="following::ol/li[1]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol/li[2]" />
+ <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsexml-attribute" data-tested-assertations="following::ol/li[2]" />
+
</head>
<body>
<div id="log"></div>