[Streams API] Implement ReadableStream cancel (abstract part)
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jun 2015 13:59:08 +0000 (13:59 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jun 2015 13:59:08 +0000 (13:59 +0000)
commit43ccf780faf79118d694e5ea0df04ac81ca404f1
tree89b8c6d98b7d3b51120425f515c365f9e739cbf7
parent207fdd76d8507e9df1f62618eac5ba8d24aeb18a
[Streams API] Implement ReadableStream cancel (abstract part)
https://bugs.webkit.org/show_bug.cgi?id=146111

Reviewed by Darin Adler.

Source/WebCore:

This patch implements ReadableStream and ReadableStreamReader cancel.
The reader delegates cancellation to its stream.

This patch also ensures that controller.close() will not throw in case cancellation is on-going.

A follow-up patch will implement the calling of 'cancel' JS callback for JS sources.

Covered by rebased tests.

* Modules/streams/ReadableStream.cpp:
(WebCore::ReadableStream::cancel): Checks whether locked or not before cancelling.
(WebCore::ReadableStream::cancelNoCheck): Cancel without lock check.
(WebCore::ReadableStream::notifyCancelSucceeded): Async cancel callback.
(WebCore::ReadableStream::notifyCancelFailed): Ditto.
* Modules/streams/ReadableStream.h:
* Modules/streams/ReadableStream.idl: Cleaned up IDL.
* Modules/streams/ReadableStreamReader.cpp:
(WebCore::ReadableStreamReader::cancel):
* Modules/streams/ReadableStreamReader.h:
* Modules/streams/ReadableStreamReader.idl: Cleaned up IDL
* bindings/js/JSReadableStreamControllerCustom.cpp:
(WebCore::JSReadableStreamController::close):
* bindings/js/JSReadableStreamCustom.cpp:
(WebCore::JSReadableStream::cancel):
* bindings/js/JSReadableStreamReaderCustom.cpp:
(WebCore::JSReadableStreamReader::cancel):
* bindings/js/ReadableJSStream.cpp:
(WebCore::ReadableJSStream::doCancel):
* bindings/js/ReadableJSStream.h:

LayoutTests:

Rebasing expectations.

* 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:
* streams/reference-implementation/readable-stream-templated-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
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
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/ReadableStream.idl
Source/WebCore/Modules/streams/ReadableStreamReader.cpp
Source/WebCore/Modules/streams/ReadableStreamReader.h
Source/WebCore/Modules/streams/ReadableStreamReader.idl
Source/WebCore/bindings/js/JSReadableStreamControllerCustom.cpp
Source/WebCore/bindings/js/JSReadableStreamCustom.cpp
Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp
Source/WebCore/bindings/js/ReadableJSStream.cpp
Source/WebCore/bindings/js/ReadableJSStream.h