[Streams API] Implement ReadableStream js source "'cancel" callback
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jun 2015 11:29:32 +0000 (11:29 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Jun 2015 11:29:32 +0000 (11:29 +0000)
commit546138c6220de78f7f4d92b171e46d365df9431b
tree4a2e2ce5d7e2a9262a70177b0ab6697dc579f60a
parent1e756a4ea8b79885fff814598db3037c5d73c681
[Streams API] Implement ReadableStream js source "'cancel" callback
https://bugs.webkit.org/show_bug.cgi?id=146204

Reviewed by Darin Adler.

Source/WebCore:

Calling "cancel" JS function when web app is cancelling a JS readable stream.
Handling of promise returned value in case of async cancel.

Covered by rebased tests.

* bindings/js/ReadableJSStream.cpp:
(WebCore::ReadableJSStream::invoke): Refactoring to pass cancel reason or controller to the JS function.
(WebCore::ReadableJSStream::doStart): Ditto.
(WebCore::startReadableStreamAsync): Renaming readableStream as protectedStream.
(WebCore::createPullResultFulfilledFunction): Ditto.
(WebCore::ReadableJSStream::doPull): Refactoring to pass cancel reason or controller to the JS function.
(WebCore::createCancelResultFulfilledFunction): Cancel promise fullfil callback.
(WebCore::createCancelResultRejectedFunction): Cancel promise reject callback.
(WebCore::ReadableJSStream::doCancel): Calling cancel JS callback and handling promise returned value.
* bindings/js/ReadableJSStream.h: Refactoring to pass cancel reason or controller to the JS function.

LayoutTests:

* streams/reference-implementation/bad-underlying-sources-expected.txt:
* streams/reference-implementation/readable-stream-cancel-expected.txt:
* streams/reference-implementation/readable-stream-expected.txt:
* streams/reference-implementation/readable-stream-reader-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/streams/reference-implementation/bad-underlying-sources-expected.txt
LayoutTests/streams/reference-implementation/readable-stream-cancel-expected.txt
LayoutTests/streams/reference-implementation/readable-stream-expected.txt
LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/ReadableJSStream.cpp
Source/WebCore/bindings/js/ReadableJSStream.h