Bug 1128959 - Implement the WHATWG Streams spec - part 10 - WPT updated, r=bkelly, r=annevk

This commit is contained in:
Andrea Marchesini 2017-08-10 18:04:55 -07:00
parent e44cd2d765
commit 75b1baa8cb
20 changed files with 29 additions and 208 deletions

View File

@ -0,0 +1,2 @@
prefs: [javascript.options.streams:true,
dom.streams.enabled:true]

View File

@ -1,11 +0,0 @@
[stream-response.any.html]
type: testharness
[Stream response's body]
expected: FAIL
[stream-response.any.worker.html]
type: testharness
[Stream response's body]
expected: FAIL

View File

@ -1 +1,2 @@
prefs: [javascript.options.streams:true]
prefs: [javascript.options.streams:true,
dom.streams.enabled:true]

View File

@ -1,20 +0,0 @@
[response-cancel-stream.html]
type: testharness
[Cancelling a starting blob Response stream]
expected: FAIL
[Cancelling a loading blob Response stream]
expected: FAIL
[Cancelling a closed blob Response stream]
expected: FAIL
[Cancelling a starting Response stream]
expected: FAIL
[Cancelling a loading Response stream]
expected: FAIL
[Cancelling a closed Response stream]
expected: FAIL

View File

@ -1,14 +1,5 @@
[response-clone.html]
type: testharness
[Check orginal response's body after cloning]
expected: FAIL
[Check cloned response's body]
expected: FAIL
[Cancelling stream should not affect cloned one]
expected: FAIL
[Check response clone use structureClone for teed ReadableStreams (Int8Arraychunk)]
expected: FAIL

View File

@ -1,29 +0,0 @@
[response-consume-stream.html]
type: testharness
[Read empty text response's body as readableStream]
expected: FAIL
[Read empty blob response's body as readableStream]
expected: FAIL
[Read blob response's body as readableStream]
expected: FAIL
[Read text response's body as readableStream]
expected: FAIL
[Read form data response's body as readableStream]
expected: FAIL
[Getting an error Response stream]
expected: FAIL
[Getting a redirect Response stream]
expected: FAIL
[Read array buffer response's body as readableStream]
expected: FAIL
[Read URLSearchParams response's body as readableStream]
expected: FAIL

View File

@ -1,38 +0,0 @@
[response-consume.html]
type: testharness
[Consume stream response's body as blob]
expected: FAIL
[Consume stream response's body as text]
expected: FAIL
[Consume stream response's body as json]
expected: FAIL
[Consume stream response's body as arrayBuffer]
expected: FAIL
[Consume response's body as formData]
expected: FAIL
[Consume formdata response's body as formData]
expected: FAIL
[Consume response's body: from stream to blob]
expected: FAIL
[Consume response's body: from stream to text]
expected: FAIL
[Consume response's body: from stream to arrayBuffer]
expected: FAIL
[Consume response's body: from stream to json]
expected: FAIL
[Consume response's body: from stream with correct multipart type to formData]
expected: FAIL
[Consume response's body: from stream with correct urlencoded type to formData]
expected: FAIL

View File

@ -1,20 +1,7 @@
[response-idl.html]
type: testharness
[Response interface: attribute body]
expected: FAIL
[Response interface: new Response() must inherit property "body" with the proper type (8)]
expected: FAIL
[Response interface: new Response() must inherit property "body" with the proper type (9)]
expected: FAIL
[Response interface: attribute trailer]
expected: FAIL
[Response interface: new Response() must inherit property "trailer" with the proper type (8)]
expected: FAIL
[Response interface: new Response() must inherit property "body" with the proper type (10)]
expected: FAIL

View File

@ -1,5 +0,0 @@
[response-init-001.html]
type: testharness
[Check default value for body attribute]
expected: FAIL

View File

@ -1,5 +0,0 @@
[response-init-002.html]
type: testharness
[Read Response's body as readableStream]
expected: FAIL

View File

@ -1,5 +0,0 @@
[response-static-error.html]
type: testharness
[Check response returned by static method error()]
expected: FAIL

View File

@ -1,14 +0,0 @@
[response-stream-disturbed-1.html]
type: testharness
[Getting blob after getting the Response body - not disturbed, not locked]
expected: FAIL
[Getting text after getting the Response body - not disturbed, not locked]
expected: FAIL
[Getting json after getting the Response body - not disturbed, not locked]
expected: FAIL
[Getting arrayBuffer after getting the Response body - not disturbed, not locked]
expected: FAIL

View File

@ -1,14 +0,0 @@
[response-stream-disturbed-2.html]
type: testharness
[Getting blob after getting a locked Response body]
expected: FAIL
[Getting text after getting a locked Response body]
expected: FAIL
[Getting json after getting a locked Response body]
expected: FAIL
[Getting arrayBuffer after getting a locked Response body]
expected: FAIL

View File

@ -1,14 +0,0 @@
[response-stream-disturbed-3.html]
type: testharness
[Getting blob after reading the Response body]
expected: FAIL
[Getting text after reading the Response body]
expected: FAIL
[Getting json after reading the Response body]
expected: FAIL
[Getting arrayBuffer after reading the Response body]
expected: FAIL

View File

@ -1,14 +0,0 @@
[response-stream-disturbed-4.html]
type: testharness
[Getting blob after cancelling the Response body]
expected: FAIL
[Getting text after cancelling the Response body]
expected: FAIL
[Getting json after cancelling the Response body]
expected: FAIL
[Getting arrayBuffer after cancelling the Response body]
expected: FAIL

View File

@ -0,0 +1,2 @@
prefs: [javascript.options.streams:true,
dom.streams.enabled:true]

View File

@ -1,5 +0,0 @@
[fetch-event-respond-with-readable-stream.https.html]
type: testharness
[Respond with a Response built from a ReadableStream]
expected: FAIL

View File

@ -33,18 +33,9 @@
[The PromiseRejectionEvent interface object should be exposed.]
expected: FAIL
[The ReadableStream interface object should be exposed.]
expected: FAIL
[The WritableStream interface object should be exposed.]
expected: FAIL
[The ByteLengthQueuingStrategy interface object should be exposed.]
expected: FAIL
[The CountQueuingStrategy interface object should be exposed.]
expected: FAIL
[001.worker.html]
type: testharness

View File

@ -81,6 +81,26 @@ function validateStreamFromString(reader, expectedValue, retrievedArrayBuffer) {
});
}
function validateStreamFromPartialString(reader, expectedValue, retrievedArrayBuffer) {
return reader.read().then(function(data) {
if (!data.done) {
assert_true(data.value instanceof Uint8Array, "Fetch ReadableStream chunks should be Uint8Array");
var newBuffer;
if (retrievedArrayBuffer) {
newBuffer = new ArrayBuffer(data.value.length + retrievedArrayBuffer.length);
newBuffer.set(retrievedArrayBuffer, 0);
newBuffer.set(data.value, retrievedArrayBuffer.length);
} else {
newBuffer = data.value;
}
return validateStreamFromPartialString(reader, expectedValue, newBuffer);
}
var string = new TextDecoder("utf-8").decode(retrievedArrayBuffer);
return assert_true(string.search(expectedValue) != -1, "Retrieve and verify stream");
});
}
// From streams tests
function delay(milliseconds)
{

View File

@ -57,14 +57,15 @@ promise_test(function(test) {
promise_test(function(test) {
var response = new Response(formData);
return validateStreamFromString(response.body.getReader(), "name=value");
return validateStreamFromPartialString(response.body.getReader(),
"Content-Disposition: form-data; name=\"name\"\r\n\r\nvalue");
}, "Read form data response's body as readableStream");
test(function() {
assert_equals(Response.error().body, null);
}, "Getting an error Response stream");
promise_test(function(test) {
test(function() {
assert_equals(Response.redirect("/").body, null);
}, "Getting a redirect Response stream");