[Streams API] Implement a barebone ReadableStreamReader interface
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Mar 2015 10:09:56 +0000 (10:09 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 Mar 2015 10:09:56 +0000 (10:09 +0000)
commitcb61b02b3d87e20c14fc3b5e624bb7456b5e9723
treeb4dffdc372c830b92e67657d2b00cf6a3c2bec9d
parent97a4f4eaa38be698dbf25d580a384223ef904eb8
[Streams API] Implement a barebone ReadableStreamReader interface
https://bugs.webkit.org/show_bug.cgi?id=142866

Reviewed by Benjamin Poulain.

Source/WebCore:

This patch implements a barebone ReadableStreamReader as described in https://streams.spec.whatwg.org/#reader-class.
It implements the IDL without implementing most of the functionality behind.
It implements ReadableStreamReader JS constructor and the link with ReadableStream.getReader:
- Raise an error if stream is already locked
- Set the stream reader to the newly created ReadableStreamReader instance.

Test: streams/readablestreamreader-constructor.html

* CMakeLists.txt: Adding ReadableStreamReader files.
* DerivedSources.cpp: Ditto.
* DerivedSources.make: Ditto.
* Modules/streams/ReadableStream.cpp:
(WebCore::ReadableStream::createReader): Used by JS binding to get access to the reader.
* Modules/streams/ReadableStream.h: Declaration of createReader, reader and lock.
(WebCore::ReadableStream::reader):
(WebCore::ReadableStream::lock):
* Modules/streams/ReadableStream.idl: Cleaning-up the IDL.
* Modules/streams/ReadableStreamReader.cpp: Added.
(WebCore::ReadableStreamReader::create):
(WebCore::ReadableStreamReader::ReadableStreamReader):
(WebCore::ReadableStreamReader::~ReadableStreamReader):
(WebCore::ReadableStreamReader::closed):
(WebCore::ReadableStreamReader::activeDOMObjectName):
(WebCore::ReadableStreamReader::canSuspend):
* Modules/streams/ReadableStreamReader.h: Added.
(WebCore::ReadableStreamReader::stream):
* Modules/streams/ReadableStreamReader.idl: Added.
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSReadableStreamCustom.cpp:
(WebCore::JSReadableStream::getReader):
* bindings/js/JSReadableStreamReaderCustom.cpp: Added.
(WebCore::JSReadableStreamReader::read):
(WebCore::getOrCreatePromiseDeferredFromObject):
(WebCore::closedPromiseSlotName):
(WebCore::JSReadableStreamReader::closed):
(WebCore::JSReadableStreamReader::cancel):
(WebCore::JSReadableStreamReader::releaseLock):
(WebCore::constructJSReadableStreamReader):

LayoutTests:

Adding tests to check API, constructor and link with ReadableStream.getReader.
Rebasing of global-constructors-attributes.html to include ReadableStreamReader.

* js/dom/global-constructors-attributes-expected.txt:
* platform/efl/js/dom/global-constructors-attributes-expected.txt:
* platform/gtk/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:
* platform/win/js/dom/global-constructors-attributes-expected.txt:
* streams/readablestreamreader-constructor-expected.txt: Added.
* streams/readablestreamreader-constructor.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182180 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/efl/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/gtk/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac-mavericks/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt
LayoutTests/platform/win/js/dom/global-constructors-attributes-expected.txt
LayoutTests/streams/readablestreamreader-constructor-expected.txt [new file with mode: 0644]
LayoutTests/streams/readablestreamreader-constructor.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/streams/ReadableStream.cpp
Source/WebCore/Modules/streams/ReadableStream.h
Source/WebCore/Modules/streams/ReadableStream.idl
Source/WebCore/Modules/streams/ReadableStreamReader.cpp [new file with mode: 0644]
Source/WebCore/Modules/streams/ReadableStreamReader.h [new file with mode: 0644]
Source/WebCore/Modules/streams/ReadableStreamReader.idl [new file with mode: 0644]
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSReadableStreamCustom.cpp
Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/ReadableStreamJSSource.cpp