diff options
14 files changed, 6 insertions, 289 deletions
diff --git a/components/script/dom/webidls/XMLHttpRequest.webidl b/components/script/dom/webidls/XMLHttpRequest.webidl index 270e45ca7ed..f6ae05c66ec 100644 --- a/components/script/dom/webidls/XMLHttpRequest.webidl +++ b/components/script/dom/webidls/XMLHttpRequest.webidl @@ -13,7 +13,7 @@ */ // https://fetch.spec.whatwg.org/#bodyinit -typedef (Blob or /*BufferSource or */ FormData or DOMString or URLSearchParams) BodyInit; +typedef (Blob or BufferSource or FormData or DOMString or URLSearchParams) BodyInit; enum XMLHttpRequestResponseType { "", diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index e818a1fd756..49a72bbf46d 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -520,6 +520,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest { Some(DocumentOrBodyInit::FormData(ref formdata)) => Some(formdata.extract()), Some(DocumentOrBodyInit::String(ref str)) => Some(str.extract()), Some(DocumentOrBodyInit::URLSearchParams(ref urlsp)) => Some(urlsp.extract()), + Some(DocumentOrBodyInit::ArrayBuffer(ref typedarray)) => Some((typedarray.to_vec(), None)), + Some(DocumentOrBodyInit::ArrayBufferView(ref typedarray)) => Some((typedarray.to_vec(), None)), None => None, }; @@ -1441,6 +1443,8 @@ impl Extractable for BodyInit { BodyInit::URLSearchParams(ref usp) => usp.extract(), BodyInit::Blob(ref b) => b.extract(), BodyInit::FormData(ref formdata) => formdata.extract(), + BodyInit::ArrayBuffer(ref typedarray) => ((typedarray.to_vec(), None)), + BodyInit::ArrayBufferView(ref typedarray) => ((typedarray.to_vec(), None)), } } } diff --git a/tests/wpt/metadata/fetch/api/basic/request-headers.any.js.ini b/tests/wpt/metadata/fetch/api/basic/request-headers.any.js.ini index ea7c5b5edf7..ec789b02d0b 100644 --- a/tests/wpt/metadata/fetch/api/basic/request-headers.any.js.ini +++ b/tests/wpt/metadata/fetch/api/basic/request-headers.any.js.ini @@ -12,24 +12,6 @@ [Fetch with POST with URLSearchParams body] expected: FAIL - [Fetch with POST with ArrayBuffer body] - expected: FAIL - - [Fetch with POST with Uint8Array body] - expected: FAIL - - [Fetch with POST with Int8Array body] - expected: FAIL - - [Fetch with POST with Float32Array body] - expected: FAIL - - [Fetch with POST with Float64Array body] - expected: FAIL - - [Fetch with POST with DataView body] - expected: FAIL - [Fetch with POST with Blob body with mime type] expected: FAIL diff --git a/tests/wpt/metadata/fetch/api/basic/request-upload.any.js.ini b/tests/wpt/metadata/fetch/api/basic/request-upload.any.js.ini index 194792a3f84..40a2537c13c 100644 --- a/tests/wpt/metadata/fetch/api/basic/request-upload.any.js.ini +++ b/tests/wpt/metadata/fetch/api/basic/request-upload.any.js.ini @@ -1,23 +1,5 @@ [request-upload.any.html] type: testharness - [Fetch with POST with ArrayBuffer body] - expected: FAIL - - [Fetch with POST with Uint8Array body] - expected: FAIL - - [Fetch with POST with Int8Array body] - expected: FAIL - - [Fetch with POST with Float32Array body] - expected: FAIL - - [Fetch with POST with Float64Array body] - expected: FAIL - - [Fetch with POST with DataView body] - expected: FAIL - [Fetch with POST with ReadableStream] expected: FAIL @@ -39,24 +21,6 @@ [request-upload.any.worker.html] type: testharness - [Fetch with POST with ArrayBuffer body] - expected: FAIL - - [Fetch with POST with Uint8Array body] - expected: FAIL - - [Fetch with POST with Int8Array body] - expected: FAIL - - [Fetch with POST with Float32Array body] - expected: FAIL - - [Fetch with POST with Float64Array body] - expected: FAIL - - [Fetch with POST with DataView body] - expected: FAIL - [Fetch with POST with ReadableStream] expected: FAIL diff --git a/tests/wpt/metadata/fetch/api/basic/text-utf8.html.ini b/tests/wpt/metadata/fetch/api/basic/text-utf8.html.ini index 1bdc4f3f39d..0eded70d2a3 100644 --- a/tests/wpt/metadata/fetch/api/basic/text-utf8.html.ini +++ b/tests/wpt/metadata/fetch/api/basic/text-utf8.html.ini @@ -12,27 +12,3 @@ [UTF-8 with BOM with fetched data (UTF-16 charset)] expected: FAIL - [UTF-8 without BOM with Request.text()] - expected: FAIL - - [UTF-8 without BOM with Response.text()] - expected: FAIL - - [UTF-16BE with BOM decoded as UTF-8 with Request.text()] - expected: FAIL - - [UTF-16BE with BOM decoded as UTF-8 with Response.text()] - expected: FAIL - - [UTF-16LE with BOM decoded as UTF-8 with Request.text()] - expected: FAIL - - [UTF-16LE with BOM decoded as UTF-8 with Response.text()] - expected: FAIL - - [UTF-16 without BOM decoded as UTF-8 with Request.text()] - expected: FAIL - - [UTF-16 without BOM decoded as UTF-8 with Response.text()] - expected: FAIL - diff --git a/tests/wpt/metadata/fetch/api/request/request-consume-empty.html.ini b/tests/wpt/metadata/fetch/api/request/request-consume-empty.html.ini index 0f807052fc9..df31b559a78 100644 --- a/tests/wpt/metadata/fetch/api/request/request-consume-empty.html.ini +++ b/tests/wpt/metadata/fetch/api/request/request-consume-empty.html.ini @@ -18,9 +18,6 @@ [Consume empty FormData request body as text] expected: FAIL - [Consume empty ArrayBuffer request body as text] - expected: FAIL - [Consume request's body as json (error case)] expected: FAIL diff --git a/tests/wpt/metadata/fetch/api/request/request-consume.html.ini b/tests/wpt/metadata/fetch/api/request/request-consume.html.ini index 8ec3d996158..6e03c77f19c 100644 --- a/tests/wpt/metadata/fetch/api/request/request-consume.html.ini +++ b/tests/wpt/metadata/fetch/api/request/request-consume.html.ini @@ -6,37 +6,7 @@ [Consume String request's body as formData] expected: FAIL - [Consume Int8Array request's body as text] - expected: FAIL - - [Consume Int8Array request's body as blob] - expected: FAIL - - [Consume Int8Array request's body as arrayBuffer] - expected: FAIL - - [Consume ArrayBuffer request's body as text] - expected: FAIL - - [Consume Float32Array request's body as blob] - expected: FAIL - - [Consume Float32Array request's body as arrayBuffer] - expected: FAIL - - [Consume Float32Array request's body as JSON] - expected: FAIL - - [Consume DataView request's body as text] - expected: FAIL - - [Consume DataView request's body as blob] - expected: FAIL - - [Consume DataView request's body as arrayBuffer] - expected: FAIL - - [Consume DataView request's body as JSON] + [Trying to consume bad JSON text as JSON: 'undefined'] expected: FAIL [Consume FormData request's body as FormData] @@ -68,4 +38,3 @@ [Consume Float32Array request's body as text] expected: FAIL - diff --git a/tests/wpt/metadata/xhr/send-data-arraybuffer.htm.ini b/tests/wpt/metadata/xhr/send-data-arraybuffer.htm.ini deleted file mode 100644 index 50e0fbb9297..00000000000 --- a/tests/wpt/metadata/xhr/send-data-arraybuffer.htm.ini +++ /dev/null @@ -1,5 +0,0 @@ -[send-data-arraybuffer.htm] - type: testharness - [XMLHttpRequest: The send() method: ArrayBuffer data] - expected: FAIL - diff --git a/tests/wpt/metadata/xhr/send-data-arraybufferview.htm.ini b/tests/wpt/metadata/xhr/send-data-arraybufferview.htm.ini deleted file mode 100644 index 88e55791307..00000000000 --- a/tests/wpt/metadata/xhr/send-data-arraybufferview.htm.ini +++ /dev/null @@ -1,5 +0,0 @@ -[send-data-arraybufferview.htm] - type: testharness - [XMLHttpRequest: The send() method: ArrayBufferView data] - expected: FAIL - diff --git a/tests/wpt/metadata/xhr/setrequestheader-content-type.htm.ini b/tests/wpt/metadata/xhr/setrequestheader-content-type.htm.ini index 684f4d84dca..6a6aba997c1 100644 --- a/tests/wpt/metadata/xhr/setrequestheader-content-type.htm.ini +++ b/tests/wpt/metadata/xhr/setrequestheader-content-type.htm.ini @@ -1,14 +1,8 @@ [setrequestheader-content-type.htm] type: testharness - [ArrayBuffer request sends no Content-Type without setRequestHeader() call] - expected: FAIL - [ArrayBuffer request keeps setRequestHeader() Content-Type and charset] expected: FAIL - [ArrayBufferView request sends no Content-Type without setRequestHeader() call] - expected: FAIL - [ArrayBufferView request keeps setRequestHeader() Content-Type and charset] expected: FAIL diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 41a059bc8b7..f436735c110 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -11593,11 +11593,6 @@ {} ] ], - "mozilla/resources/content.py": [ - [ - {} - ] - ], "mozilla/resources/external.js": [ [ {} @@ -39096,18 +39091,6 @@ {} ] ], - "mozilla/send-arraybuffer.htm": [ - [ - "/_mozilla/mozilla/send-arraybuffer.htm", - {} - ] - ], - "mozilla/send-blob.htm": [ - [ - "/_mozilla/mozilla/send-blob.htm", - {} - ] - ], "mozilla/sequence-hole.html": [ [ "/_mozilla/mozilla/sequence-hole.html", @@ -70613,10 +70596,6 @@ "1a76b81400b1e150f008d11180adcdf786e77b67", "support" ], - "mozilla/resources/content.py": [ - "5cf25421cc9c0e0f88a159b363f99f37036d019f", - "support" - ], "mozilla/resources/external.js": [ "78686147f85e4146e7fc58c1f67a613f65b099a2", "support" @@ -70705,14 +70684,6 @@ "fc757effccd93c56ab79b0510a01ae815b7a8714", "testharness" ], - "mozilla/send-arraybuffer.htm": [ - "dc04c6f888458b28bd29a3a43f4dab7f12e72a33", - "testharness" - ], - "mozilla/send-blob.htm": [ - "5d8d62c0c2c27edbb875183a31a9005c950141cc", - "testharness" - ], "mozilla/sequence-hole.html": [ "db0cc2660c8d937ccf6e3334c92dc48208c69841", "testharness" diff --git a/tests/wpt/mozilla/tests/mozilla/resources/content.py b/tests/wpt/mozilla/tests/mozilla/resources/content.py deleted file mode 100644 index 9369f21171c..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/resources/content.py +++ /dev/null @@ -1,18 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - -def main(request, response): - headers = [("Content-type", "text/plain"), - ("X-Request-Method", request.method), - ("X-Request-Query", request.url_parts.query if request.url_parts.query else "NO"), - ("X-Request-Content-Length", request.headers.get("Content-Length", "NO")), - ("X-Request-Content-Type", request.headers.get("Content-Type", "NO"))] - - if "content" in request.GET: - content = request.GET.first("content") - else: - content = request.body - - return headers, content diff --git a/tests/wpt/mozilla/tests/mozilla/send-arraybuffer.htm b/tests/wpt/mozilla/tests/mozilla/send-arraybuffer.htm deleted file mode 100644 index 9b297c8f232..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/send-arraybuffer.htm +++ /dev/null @@ -1,50 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[4]/dl[1]/dd[1]"/> - <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol[1]/li[3]"/> - <link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::ol[1]/li[3]"/> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <title>XMLHttpRequest: The send() method: ArrayBuffer data</title> -</head> - -<body> - <div id="log"></div> - - <script type="text/javascript"> - var test = async_test(); - - test.step(function() - { - var xhr = new XMLHttpRequest(); - var buf = new ArrayBuffer(5); - var arr = new Uint8Array(buf); - arr[0] = 0x48; - arr[1] = 0x65; - arr[2] = 0x6c; - arr[3] = 0x6c; - arr[4] = 0x6f; - - xhr.onreadystatechange = function() - { - if (xhr.readyState == 4) - { - test.step(function() - { - var arr = xhr.response; - assert_equals(xhr.status, 200); - assert_equals(typeof arr, "string"); - assert_equals(arr, "[object ArrayBuffer]"); - - test.done(); - }); - } - }; - - xhr.open("POST", "./resources/content.py", true); - xhr.send(buf); - }); - </script> -</body> -</html> diff --git a/tests/wpt/mozilla/tests/mozilla/send-blob.htm b/tests/wpt/mozilla/tests/mozilla/send-blob.htm deleted file mode 100644 index 895aae6d77b..00000000000 --- a/tests/wpt/mozilla/tests/mozilla/send-blob.htm +++ /dev/null @@ -1,62 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[4]/dl[1]/dd[2]/p[3]"/> - <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol[1]/li[3]"/> - <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetype-attribute" data-tested-assertations="following::ol[1]/li[4]"/> - <link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::a[contains(@href,'#blob-response-entity-body')]/.."/> - - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <title>XMLHttpRequest: The send() method: Blob data</title> -</head> - -<body> - <div id="log"></div> - - <script type="text/javascript"> - var test = async_test(); - - test.step(function() - { - var xhr = new XMLHttpRequest(); - var xhr2 = new XMLHttpRequest(); - - var content = "Hello"; - var blob; - - xhr.onreadystatechange = function() - { - if (xhr.readyState == 4) - { - test.step(function() - { - blob = xhr.response; - assert_equals(typeof blob, "string"); - assert_true(blob == "Hello", "Blob equals Hello"); - - xhr2.open("POST", "resources/content.py", true); - xhr2.send(blob); - }); - } - } - - xhr2.onreadystatechange = function() - { - if (xhr2.readyState == 4) - { - test.step(function() - { - assert_equals(xhr2.status, 200); - assert_equals(xhr2.response, content); - test.done(); - }); - } - }; - - xhr.open("GET", "./resources/content.py?content=" + content, true); - xhr.send(); - }); - </script> -</body> -</html> |