[Streams API] Collecting a ReadableStreamReader should not unlock its stream
authoryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Apr 2015 17:16:21 +0000 (17:16 +0000)
committeryouenn.fablet@crf.canon.fr <youenn.fablet@crf.canon.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Apr 2015 17:16:21 +0000 (17:16 +0000)
commit330119d85192a8ef516b4ed142345de176b569c6
tree129d070c222219295d81065bd84d1a751ea0be8b
parent13e10df08b124e256345fb3849b826430895d500
[Streams API] Collecting a ReadableStreamReader should not unlock its stream
https://bugs.webkit.org/show_bug.cgi?id=143333

Reviewed by Benjamin Poulain.

Source/WebCore:

This patch stores as a boolean whether the stream is locked to a reader.
In case the reader forget to unlock the stream, the reader can be collected and destructor called.
In that case, the link between reader and stream will be reset but the stream will remain in locked state.

Covered by new test in streams/readablestreamreader-constructor.html.

* Modules/streams/ReadableStream.h:
(WebCore::ReadableStream::isLocked):
(WebCore::ReadableStream::lock):
(WebCore::ReadableStream::release):
(WebCore::ReadableStream::releaseButKeepLocked): Introduced to cut the link between reader and stream but stil keeping the stream locked.
* Modules/streams/ReadableStreamReader.cpp:
(WebCore::ReadableStreamReader::~ReadableStreamReader):
* bindings/js/JSReadableStreamCustom.cpp:
(WebCore::JSReadableStream::getReader):
* bindings/js/JSReadableStreamReaderCustom.cpp:
(WebCore::constructJSReadableStreamReader):

LayoutTests:

* streams/readablestreamreader-constructor-expected.txt:
* streams/readablestreamreader-constructor.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/streams/readablestreamreader-constructor-expected.txt
LayoutTests/streams/readablestreamreader-constructor.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/streams/ReadableStream.h
Source/WebCore/Modules/streams/ReadableStreamReader.cpp
Source/WebCore/bindings/js/JSReadableStreamCustom.cpp
Source/WebCore/bindings/js/JSReadableStreamReaderCustom.cpp