haikuwebkit/LayoutTests/streams/readable-stream-default-rea...

8 lines
285 B
Plaintext
Raw Permalink Normal View History

Source/WebCore: [Streams API] Implement ReadableStreamReader read method in closed and errored state https://bugs.webkit.org/show_bug.cgi?id=144790 Reviewed by Darin Adler. Reader delegates read() promise handling to its stream except if reader is no longer locking the stream and stream is readable. Storing of reader read() promise callbacks as a Vector in ReadableStream. Added resolution/rejection of read() promises in case of errored/closed streams. Test: streams/readable-stream-reader-read.html * ForwardingHeaders/runtime/IteratorOperations.h: Added. * Modules/streams/ReadableStream.cpp: (WebCore::ReadableStream::cleanCallbacks): Clean the read requests. (WebCore::ReadableStream::changeStateToClosed): Run success callbacks with undefined for read requests. (WebCore::ReadableStream::changeStateToErrored): Run failure callbacks with the errors for read requests. (WebCore::ReadableStream::closed): Parameter name changed. (WebCore::ReadableStream::read): Added. Succeeds with empty when closed, fails with error when errored, reads a value if there is one and pushes the callbacks to the queue otherwise. * Modules/streams/ReadableStream.h: (WebCore::ReadableStream::ReadCallbacks::ReadCallbacks): Struct containing success and failure callbacks. * Modules/streams/ReadableStreamReader.cpp: (WebCore::ReadableStreamReader::closed): Parameter name changed. (WebCore::ReadableStreamReader::read): Invoke success with empty if we streams if we don't have the right reader and call the stream otherwise to read. * Modules/streams/ReadableStreamReader.h: * bindings/js/JSReadableStreamReaderCustom.cpp: (WebCore::JSReadableStreamReader::read): Create the callback lambdas and invoke read. Failure rejects the promise and success creates the result from the read value. * bindings/js/ReadableJSStream.cpp: (WebCore::ReadableJSStream::hasValue): (WebCore::ReadableJSStream::read): Not implemented yet. * bindings/js/ReadableJSStream.h: Source/WTF: [Streams API] Delegate ReadableStreamReader reference counting to ReadableStream https://bugs.webkit.org/show_bug.cgi?id=144907 Reviewed by Darin Adler. * wtf/Vector.h: (WTF::Vector::append): Adding not templated append method, forwarding to ValueType templated append method. LayoutTests: [Streams API] Implement ReadableStreamReader read method in closed and errored state https://bugs.webkit.org/show_bug.cgi?id=144790 Reviewed by Darin Adler. Added new test. Rebased reference tests (expectations and timeouting/untimeouting tests). Removed temporarily some tests in streams/reference-implementation/readable-stream-templated.html. These tests try to check handling promise returned in start method which is not yet supported. If we did not comment these tests, they would be flaky. * streams/readable-stream-reader-read-expected.txt: Added. * streams/readable-stream-reader-read.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: * 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-reader.html: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/readable-stream.html: Canonical link: https://commits.webkit.org/163599@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-02 19:28:11 +00:00
PASS Reading twice on a stream that gets closed
PASS Reading twice on a closed stream
PASS Reading twice on an errored stream
PASS Reading twice on a stream that gets errored
PASS ReadableStream: if start rejects with no parameter, it should error the stream with an undefined error
Source/WebCore: [Streams API] Implement ReadableStreamReader read method in closed and errored state https://bugs.webkit.org/show_bug.cgi?id=144790 Reviewed by Darin Adler. Reader delegates read() promise handling to its stream except if reader is no longer locking the stream and stream is readable. Storing of reader read() promise callbacks as a Vector in ReadableStream. Added resolution/rejection of read() promises in case of errored/closed streams. Test: streams/readable-stream-reader-read.html * ForwardingHeaders/runtime/IteratorOperations.h: Added. * Modules/streams/ReadableStream.cpp: (WebCore::ReadableStream::cleanCallbacks): Clean the read requests. (WebCore::ReadableStream::changeStateToClosed): Run success callbacks with undefined for read requests. (WebCore::ReadableStream::changeStateToErrored): Run failure callbacks with the errors for read requests. (WebCore::ReadableStream::closed): Parameter name changed. (WebCore::ReadableStream::read): Added. Succeeds with empty when closed, fails with error when errored, reads a value if there is one and pushes the callbacks to the queue otherwise. * Modules/streams/ReadableStream.h: (WebCore::ReadableStream::ReadCallbacks::ReadCallbacks): Struct containing success and failure callbacks. * Modules/streams/ReadableStreamReader.cpp: (WebCore::ReadableStreamReader::closed): Parameter name changed. (WebCore::ReadableStreamReader::read): Invoke success with empty if we streams if we don't have the right reader and call the stream otherwise to read. * Modules/streams/ReadableStreamReader.h: * bindings/js/JSReadableStreamReaderCustom.cpp: (WebCore::JSReadableStreamReader::read): Create the callback lambdas and invoke read. Failure rejects the promise and success creates the result from the read value. * bindings/js/ReadableJSStream.cpp: (WebCore::ReadableJSStream::hasValue): (WebCore::ReadableJSStream::read): Not implemented yet. * bindings/js/ReadableJSStream.h: Source/WTF: [Streams API] Delegate ReadableStreamReader reference counting to ReadableStream https://bugs.webkit.org/show_bug.cgi?id=144907 Reviewed by Darin Adler. * wtf/Vector.h: (WTF::Vector::append): Adding not templated append method, forwarding to ValueType templated append method. LayoutTests: [Streams API] Implement ReadableStreamReader read method in closed and errored state https://bugs.webkit.org/show_bug.cgi?id=144790 Reviewed by Darin Adler. Added new test. Rebased reference tests (expectations and timeouting/untimeouting tests). Removed temporarily some tests in streams/reference-implementation/readable-stream-templated.html. These tests try to check handling promise returned in start method which is not yet supported. If we did not comment these tests, they would be flaky. * streams/readable-stream-reader-read-expected.txt: Added. * streams/readable-stream-reader-read.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: * 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-reader.html: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/readable-stream.html: Canonical link: https://commits.webkit.org/163599@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185114 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-02 19:28:11 +00:00