Skip to content
Permalink
Browse files
Re-sync XMLHttpRequests Web-Platform-Tests
https://bugs.webkit.org/show_bug.cgi?id=178172

Reviewed by Youenn Fablet.

Re-sync XMLHttpRequests Web-Platform-Tests from upstream 2f76ef2c1d.

* resources/import-expectations.json:
* web-platform-tests/XMLHttpRequest/abort-after-stop-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/abort-after-stop.htm: Added.
* web-platform-tests/XMLHttpRequest/event-error-order.sub-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/event-error-order.sub.html: Added.
* web-platform-tests/XMLHttpRequest/event-timeout-order-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/event-timeout-order.htm: Added.
* 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/preserve-ua-header-on-redirect-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/preserve-ua-header-on-redirect.htm: Added.
* web-platform-tests/XMLHttpRequest/responsedocument-decoding-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/responsedocument-decoding.htm: Added.
* web-platform-tests/XMLHttpRequest/responsetext-decoding-expected.txt:
* web-platform-tests/XMLHttpRequest/responsetext-decoding.htm:
* web-platform-tests/XMLHttpRequest/send-after-setting-document-domain-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-after-setting-document-domain.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-not-enabled-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-expected.txt: 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-expected.txt: 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-network-error-async-events.sub-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm: Added.
* web-platform-tests/XMLHttpRequest/w3c-import.log:


Canonical link: https://commits.webkit.org/194433@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Oct 11, 2017
1 parent 74d3696 commit a19ed2eba3dda1a30608cf3dfe260b62fe6d0a0a
Showing 32 changed files with 753 additions and 44 deletions.
@@ -1,3 +1,47 @@
2017-10-11 Chris Dumez <cdumez@apple.com>

Re-sync XMLHttpRequests Web-Platform-Tests
https://bugs.webkit.org/show_bug.cgi?id=178172

Reviewed by Youenn Fablet.

Re-sync XMLHttpRequests Web-Platform-Tests from upstream 2f76ef2c1d.

* resources/import-expectations.json:
* web-platform-tests/XMLHttpRequest/abort-after-stop-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/abort-after-stop.htm: Added.
* web-platform-tests/XMLHttpRequest/event-error-order.sub-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/event-error-order.sub.html: Added.
* web-platform-tests/XMLHttpRequest/event-timeout-order-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/event-timeout-order.htm: Added.
* 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/preserve-ua-header-on-redirect-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/preserve-ua-header-on-redirect.htm: Added.
* web-platform-tests/XMLHttpRequest/responsedocument-decoding-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/responsedocument-decoding.htm: Added.
* web-platform-tests/XMLHttpRequest/responsetext-decoding-expected.txt:
* web-platform-tests/XMLHttpRequest/responsetext-decoding.htm:
* web-platform-tests/XMLHttpRequest/send-after-setting-document-domain-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-after-setting-document-domain.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-not-enabled-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors-not-enabled.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-cors.htm: Added.
* web-platform-tests/XMLHttpRequest/send-authentication-basic-expected.txt: 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-expected.txt: 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-network-error-async-events.sub-expected.txt: Added.
* web-platform-tests/XMLHttpRequest/send-network-error-async-events.sub.htm: Added.
* web-platform-tests/XMLHttpRequest/w3c-import.log:

2017-10-11 Youenn Fablet <youenn@apple.com>

Import media capture WPT tests
@@ -0,0 +1,5 @@

Harness Error (TIMEOUT), message = null

FAIL XMLHttpRequest: abort event should fire when stop() method is used assert_equals: expected true but got false

@@ -0,0 +1,30 @@
<!doctype html>
<html>
<head>
<title>XMLHttpRequest: abort event should fire when stop() method is used</title>
<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::dt[3] following::dt[3]/following::dd[1]/p"/>
</head>
<body>
<div id="log"></div>
<script>
var test = async_test();
test.step(function() {
var client = new XMLHttpRequest();
var abortFired = false;
client.onabort = test.step_func(function (e) {
assert_equals(e.type, 'abort');
abortFired = true;
});
client.open("GET", "resources/delay.py?ms=3000", true);
client.send(null);
test.step_timeout(() => {
assert_equals(abortFired, true);
test.done();
}, 200);
window.stop();
});
</script>
</body>
</html>
@@ -0,0 +1,4 @@
CONSOLE MESSAGE: XMLHttpRequest cannot load http://nonexistent-origin.localhost:8800/ due to access control checks.

FAIL XMLHttpRequest: event - error (order of events) assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)"

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta name="assert" content="Check the order of events fired when the request has failed.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-event-order.js"></script>
<title>XMLHttpRequest: event - error (order of events)</title>
</head>

<body>
<div id="log"></div>

<script type="text/javascript">
var test = async_test();

test.step(function()
{
var xhr = new XMLHttpRequest();
prepare_xhr_for_event_order_test(xhr);

xhr.addEventListener("loadend", function() {
test.step(function() {
// no progress events due to CORS failure
assert_xhr_event_order_matches([1, "loadstart(0,0,false)", "upload.loadstart(0,12,true)", 2, 4, "upload.error(0,0,false)", "upload.loadend(0,0,false)", "error(0,0,false)", "loadend(0,0,false)"]);
test.done();
});
});

xhr.open("POST", "http://nonexistent-origin.{{host}}:{{ports[http][0]}}", true);
xhr.send("Test Message");
});
</script>
</body>
</html>
@@ -0,0 +1,3 @@

FAIL XMLHttpRequest: event - timeout (order of events) assert_equals: expected "upload.loadstart(0,12,true)" but got "upload.loadstart(0,0,false)"

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta name="assert" content="Check the order of events fired when the request has failed.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/xmlhttprequest-event-order.js"></script>
<title>XMLHttpRequest: event - timeout (order of events)</title>
</head>

<body>
<div id="log"></div>

<script type="text/javascript">
var test = async_test();

test.step(function()
{
var xhr = new XMLHttpRequest();
prepare_xhr_for_event_order_test(xhr);
xhr.addEventListener("loadend", function() {
test.step(function() {
assert_xhr_event_order_matches([1, "loadstart(0,0,false)", "upload.loadstart(0,12,true)", 4, "upload.timeout(0,0,false)", "upload.loadend(0,0,false)", "timeout(0,0,false)", "loadend(0,0,false)"]);
test.done();
});
});

xhr.timeout = 5;
xhr.open("POST", "resources/delay.py?ms=20000");
xhr.send("Test Message");
test.step_timeout(() => {
assert_unreached("ontimeout not called.");
}, 10);
});
</script>
</body>
</html>
@@ -0,0 +1,7 @@
Blocked access to external URL http://www2.localhost:8800/XMLHttpRequest/resources/inspect-headers.py?filter_name=origin&cors

PASS XMLHttpRequest: worker scripts, origin and referrer
FAIL Origin header assert_equals: expected "Origin: http://localhost:8800\n" but got ""
PASS Referer header
PASS Request URL test

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>XMLHttpRequest: worker scripts, origin and referrer</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[3] following::OL[1]/LI[3]/ol[1]/li[1] following::OL[1]/LI[3]/ol[1]/li[2] following::OL[1]/LI[3]/ol[1]/li[3]" />
</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 worker = new Worker("resources/workerxhr-origin-referrer.js")
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>

@@ -0,0 +1,8 @@

PASS XMLHttpRequest: response document decoding (application/xml %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)
PASS XMLHttpRequest: response document decoding (application/xml;charset=utf-8 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)
PASS XMLHttpRequest: response document decoding (application/xml;charset=windows-1252 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)
PASS XMLHttpRequest: response document decoding (text/html %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)
PASS XMLHttpRequest: response document decoding (text/html;charset=utf-8 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)
PASS XMLHttpRequest: response document decoding (text/html;charset=windows-1252 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E)

@@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>XMLHttpRequest: response document decoding</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
function request(type, input, expected) {
async_test((test) => {
const client = new XMLHttpRequest();
client.responseType = 'document';
client.open("GET", "resources/status.py?content=" + input + "&type=" + encodeURIComponent(type), true);
client.onload = test.step_func_done(() => {
assert_equals(client.responseXML.querySelector("x").textContent, expected);
})
client.send(null);
}, document.title + " (" + type + " " + input + ")");
}

const encoded_content = "%e6%a9%9f";
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>");
const decoded_as_windows_1252 = "\u00e6\u00a9\u0178";
const decoded_as_utf_8 = "\u6a5f";

request("application/xml", encoded_xml, decoded_as_windows_1252);
request("application/xml;charset=utf-8", encoded_xml, decoded_as_utf_8);
request("application/xml;charset=windows-1252", encoded_xml, decoded_as_windows_1252);
request("text/html", encoded_html, decoded_as_windows_1252);
request("text/html;charset=utf-8", encoded_html, decoded_as_utf_8);
request("text/html;charset=windows-1252", encoded_html, decoded_as_windows_1252);
</script>
</body>
</html>
@@ -1,17 +1,38 @@

PASS XMLHttpRequest: responseText decoding (application/xml %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%FF%3C%2Fx%3E)
FAIL XMLHttpRequest: responseText decoding (text/html %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%FF) assert_equals: expected "<!doctype html><meta charset=windows-1252>\ufffd" but got "<!doctype html><meta charset=windows-1252>ÿ"
PASS XMLHttpRequest: responseText decoding (text/plain;charset=windows-1252 %FF)
PASS XMLHttpRequest: responseText decoding (text/plain %FF)
PASS XMLHttpRequest: responseText decoding (text/plain %FE%FF)
PASS XMLHttpRequest: responseText decoding (text/plain %FE%FF%FE%FF)
PASS XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF)
PASS XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF%EF%BB%BF)
PASS XMLHttpRequest: responseText decoding (text/plain %C2)
PASS XMLHttpRequest: responseText decoding (text/xml %FE%FF)
PASS XMLHttpRequest: responseText decoding (text/xml %FE%FF%FE%FF)
PASS XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF)
PASS XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF%EF%BB%BF)
PASS XMLHttpRequest: responseText decoding (text/plain %E3%81%B2)
FAIL XMLHttpRequest: responseText decoding (text/xml %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%E3%81%B2%3C%2Fx%3E) assert_equals: expected "<?xml version='1.0' encoding='windows-1252'?><x>ひ</x>" but got "<?xml version='1.0' encoding='windows-1252'?><x>ひ</x>"
PASS XMLHttpRequest: responseText decoding (application/xml %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)
FAIL XMLHttpRequest: responseText decoding (text/html %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty) assert_equals: expected "<!doctype html><meta charset=windows-1252><x>機</x>" but got "<!doctype html><meta charset=windows-1252><x>æ©Ÿ</x>"
PASS XMLHttpRequest: responseText decoding (application/xml;charset=utf-8 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)
PASS XMLHttpRequest: responseText decoding (application/xml;charset=windows-1252 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)
PASS XMLHttpRequest: responseText decoding (text/html;charset=utf-8 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)
PASS XMLHttpRequest: responseText decoding (text/html;charset=windows-1252 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E empty)
PASS XMLHttpRequest: responseText decoding (text/plain;charset=windows-1252 %FF empty)
PASS XMLHttpRequest: responseText decoding (text/plain %FF empty)
PASS XMLHttpRequest: responseText decoding (text/plain %FE%FF empty)
PASS XMLHttpRequest: responseText decoding (text/plain %FE%FF%FE%FF empty)
PASS XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF empty)
PASS XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF%EF%BB%BF empty)
PASS XMLHttpRequest: responseText decoding (text/plain %C2 empty)
PASS XMLHttpRequest: responseText decoding (text/xml %FE%FF empty)
PASS XMLHttpRequest: responseText decoding (text/xml %FE%FF%FE%FF empty)
PASS XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF empty)
PASS XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF%EF%BB%BF empty)
PASS XMLHttpRequest: responseText decoding (text/plain %E3%81%B2 empty)
FAIL XMLHttpRequest: responseText decoding (application/xml %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text) assert_equals: expected "<?xml version='1.0' encoding='windows-1252'?><x>機</x>" but got "<?xml version='1.0' encoding='windows-1252'?><x>æ©Ÿ</x>"
FAIL XMLHttpRequest: responseText decoding (text/html %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text) assert_equals: expected "<!doctype html><meta charset=windows-1252><x>機</x>" but got "<!doctype html><meta charset=windows-1252><x>æ©Ÿ</x>"
PASS XMLHttpRequest: responseText decoding (application/xml;charset=utf-8 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)
PASS XMLHttpRequest: responseText decoding (application/xml;charset=windows-1252 %3C%3Fxml%20version%3D'1.0'%20encoding%3D'windows-1252'%3F%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)
PASS XMLHttpRequest: responseText decoding (text/html;charset=utf-8 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)
PASS XMLHttpRequest: responseText decoding (text/html;charset=windows-1252 %3C!doctype%20html%3E%3Cmeta%20charset%3Dwindows-1252%3E%3Cx%3E%e6%a9%9f%3C%2Fx%3E text)
PASS XMLHttpRequest: responseText decoding (text/plain;charset=windows-1252 %FF text)
PASS XMLHttpRequest: responseText decoding (text/plain %FF text)
PASS XMLHttpRequest: responseText decoding (text/plain %FE%FF text)
PASS XMLHttpRequest: responseText decoding (text/plain %FE%FF%FE%FF text)
PASS XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF text)
PASS XMLHttpRequest: responseText decoding (text/plain %EF%BB%BF%EF%BB%BF text)
PASS XMLHttpRequest: responseText decoding (text/plain %C2 text)
PASS XMLHttpRequest: responseText decoding (text/xml %FE%FF text)
PASS XMLHttpRequest: responseText decoding (text/xml %FE%FF%FE%FF text)
PASS XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF text)
PASS XMLHttpRequest: responseText decoding (text/xml %EF%BB%BF%EF%BB%BF text)
PASS XMLHttpRequest: responseText decoding (text/plain %E3%81%B2 text)

0 comments on commit a19ed2e

Please sign in to comment.