[Streams API] ReadableStream constructor start function should be able to error the...
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2015 10:44:06 +0000 (10:44 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 May 2015 10:44:06 +0000 (10:44 +0000)
commitc4eba441476c9a2c498dba1cd94fd41b61e6490d
tree14e6f317f1a80e047633ef7c07267915f927a622
parent4e673194c41492d59132fd0c8d4b54e1f9b27fc5
[Streams API] ReadableStream constructor start function should be able to error the stream
https://bugs.webkit.org/show_bug.cgi?id=141162

Reviewed by Darin Adler.

Source/WebCore:

This patch implements the functionality of the ReadableStreamController error function.
It basically changes the state of the stream to errored, resolves the ready promise and rejects the closed promise.
Adding support to reject promise with any JSValue.

Support for storing the error is added to both reader and stream.

Test: streams/readable-stream-controller-error.html and rebased tests

* Modules/streams/ReadableStream.cpp:
(WebCore::ReadableStream::changeStateToErrored):
* Modules/streams/ReadableStream.h:
* Modules/streams/ReadableStreamReader.cpp:
(WebCore::ReadableStreamReader::initialize):
(WebCore::ReadableStreamReader::closed):
(WebCore::ReadableStreamReader::changeStateToClosed):
(WebCore::ReadableStreamReader::changeStateToErrored):
* Modules/streams/ReadableStreamReader.h:
* bindings/js/JSDOMPromise.h:
(WebCore::DeferredWrapper::reject):
* bindings/js/JSReadableStreamControllerCustom.cpp:
(WebCore::JSReadableStreamController::error):
* bindings/js/JSReadableStreamReaderCustom.cpp:
(WebCore::JSReadableStreamReader::closed):
* bindings/js/ReadableJSStream.cpp:
(WebCore::ReadableJSStream::createReader):
(WebCore::ReadableJSStream::storeError):
(WebCore::ReadableJSStream::Reader::storeError):
(WebCore::ReadableJSStream::jsController): Deleted.
* bindings/js/ReadableJSStream.h:

LayoutTests:

* streams/readable-stream-controller-error-expected.txt: Added.
* streams/readable-stream-controller-error.html: Added.
* streams/reference-implementation/bad-underlying-sources-expected.txt:
* streams/reference-implementation/readable-stream-templated-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183991 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/streams/readable-stream-controller-error-expected.txt [new file with mode: 0644]
LayoutTests/streams/readable-stream-controller-error.html [new file with mode: 0644]
LayoutTests/streams/reference-implementation/bad-underlying-sources-expected.txt
LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/streams/ReadableStream.cpp
Source/WebCore/Modules/streams/ReadableStream.h
Source/WebCore/Modules/streams/ReadableStreamReader.cpp
Source/WebCore/Modules/streams/ReadableStreamReader.h
Source/WebCore/bindings/js/JSDOMPromise.h
Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp
Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp
Source/WebCore/bindings/js/ReadableJSStream.cpp
Source/WebCore/bindings/js/ReadableJSStream.h