Source/WebCore:
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jul 2015 08:00:22 +0000 (08:00 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Jul 2015 08:00:22 +0000 (08:00 +0000)
commit57ccfad526dd5c2ece628d44611ff680f8ed1815
tree0eb99f564e38d87cafe480d28d85595b780cf180
parent4c07eae2cf9124bff4bc866cc09cdd0d42f6f389
Source/WebCore:
[Streams API] Remove ReadableStreamReader.read() custom binding
https://bugs.webkit.org/show_bug.cgi?id=146643

Reviewed by Darin Adler.

Moved ReadableStreamReader.read handling from callbacks to promises.
Introduced DOMPromiseIteratorWithCallback for that purpose: it takes resolve() to resolve a promise with a not-ending iterator value,
resolveEnd() to resolve a promise with a terminating iterator value and reject().
Added template helper routine to convert typed values to JS iterator wrapping the value.
Removed ReadableStreamReader.read custom binding.

Covered by rebased tests.

* Modules/streams/ReadableStream.cpp: Updated code to use DOMPromiseIteratorWithCallback API.
(WebCore::ReadableStream::releaseReader):
(WebCore::ReadableStream::changeStateToErrored):
(WebCore::ReadableStream::read):
(WebCore::ReadableStream::resolveReadCallback):
* Modules/streams/ReadableStream.h:
* Modules/streams/ReadableStreamReader.cpp:
(WebCore::ReadableStreamReader::read):
* Modules/streams/ReadableStreamReader.h:
* Modules/streams/ReadableStreamReader.idl: Removed custom binding.
* bindings/js/JSDOMBinding.h:
(WebCore::toJSIterator): create JS iterator from typed value.
(WebCore::toJSIteratorEnd): create JS end iterator.
* bindings/js/JSDOMPromise.cpp:
(WebCore::DeferredWrapper::globalObject): Added globaObject getter and removed promise getter.
* bindings/js/JSDOMPromise.h:
(WebCore::DOMPromiseIteratorWithCallback::DOMPromiseIteratorWithCallback):
(WebCore::Error>::resolve):
(WebCore::Error>::resolveEnd):
(WebCore::Error>::reject):
* bindings/js/JSReadableStreamReaderCustom.cpp: Removed custom binding.

LayoutTests:
[Streams API] Remove ReadableStreamStream.read() custom binding
https://bugs.webkit.org/show_bug.cgi?id=146643

Reviewed by Darin Adler.

* streams/reference-implementation/brand-checks-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186414 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
LayoutTests/ChangeLog
LayoutTests/streams/reference-implementation/brand-checks-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/Modules/streams/ReadableStreamReader.idl
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSDOMPromise.cpp
Source/WebCore/bindings/js/JSDOMPromise.h
Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp