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

154 lines
4.6 KiB
HTML
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
<!DOCTYPE html>
<script src='../resources/testharness.js'></script>
<script src='../resources/testharnessreport.js'></script>
<script>
[Streams API] Fix cosmetic things after importing spec tests https://bugs.webkit.org/show_bug.cgi?id=152479 Reviewed by Youenn Fablet. Spec version are mainly updated in this patch as it wasn't done when importing tests from the spec. Some other minor changes were done, as renumbering some tests, removing some orphan expectations and other styling issues. * streams/brand-checks.html: * streams/pipe-to.html: * streams/readable-stream-controller-error.html: * streams/readable-stream-pipeThrough.html: * streams/readable-stream-reader-read.html: * streams/reference-implementation/abstract-ops.html: * streams/reference-implementation/bad-strategies.html: * streams/reference-implementation/bad-underlying-sinks.html: * streams/reference-implementation/bad-underlying-sources-expected.txt: Removed. * streams/reference-implementation/brand-checks.html: * streams/reference-implementation/byte-length-queuing-strategy.html: * streams/reference-implementation/count-queuing-strategy.html: * streams/reference-implementation/pipe-through.html: * streams/reference-implementation/pipe-to-options.html: * streams/reference-implementation/pipe-to.html: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/transform-stream-errors.html: * streams/reference-implementation/transform-stream.html: * streams/reference-implementation/writable-stream-abort.html: * streams/reference-implementation/writable-stream-expected.txt: * streams/reference-implementation/writable-stream.html: Canonical link: https://commits.webkit.org/170606@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-12-22 18:20:49 +00:00
// This is updated till https://github.com/whatwg/streams/commit/4ba861e6f60c248060811830e11271c84b439cc3
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
var test1 = async_test('Reading twice on a stream that gets closed');
test1.step(function() {
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
var controller;
var rs = new ReadableStream({
start: function(c) {
controller = c;
}
});
var counter = 0;
var reader = rs.getReader();
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.read().then(test1.step_func(function(result) {
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
assert_object_equals(result, { value: undefined, done: true }, 'read() should fulfill with close');
assert_equals(++counter, 1);
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
}));
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.read().then(test1.step_func(function(result) {
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
assert_object_equals(result, { value: undefined, done: true }, 'read() should fulfill with close');
assert_equals(++counter, 2);
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
}));
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.closed.then(test1.step_func(function() {
assert_equals(++counter, 3);
test1.done();
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
}));
controller.close();
});
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
var test2 = async_test('Reading twice on a closed stream');
test2.step(function() {
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
var controller;
var rs = new ReadableStream({
start: function(c) {
controller = c;
}
});
controller.close();
var counter = 0;
var reader = rs.getReader();
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.read().then(test2.step_func(function(result) {
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
assert_object_equals(result, { value: undefined, done: true }, 'read() should fulfill with close');
assert_equals(counter, 0);
counter++;
}));
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.read().then(test2.step_func(function(result) {
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
assert_object_equals(result, { value: undefined, done: true }, 'read() should fulfill with close');
assert_equals(counter, 1);
counter++;
}));
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.closed.then(test2.step_func(function() {
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
assert_equals(counter, 2);
counter++;
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
test2.done();
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
}));
});
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
var test3 = async_test('Reading twice on an errored stream');
test3.step(function() {
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
var controller;
var rs = new ReadableStream({
start: function(c) {
controller = c;
}
});
var myError = { potato: "mashed" };
controller.error(myError);
var counter = 0;
var reader = rs.getReader();
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.read().then(test3.step_func(function() {
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
assert_unreached('read() should reject on an errored stream');
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
}), test3.step_func(function(err) {
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
assert_equals(myError, err);
assert_equals(counter, 0);
counter++;
}));
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.read().then(test3.step_func(function() {
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
assert_unreached('read() should reject on an errored stream');
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
}), test3.step_func(function(err) {
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
assert_equals(myError, err);
assert_equals(counter, 1);
counter++;
}));
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.closed.then(test3.step_func(function() {
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
assert_unreached('read() should reject on an errored stream');
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
}), test3.step_func(function(err) {
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
assert_equals(myError, err);
assert_equals(counter, 2);
counter++;
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
test3.done();
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
}));
});
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
var test4 = async_test('Reading twice on a stream that gets errored');
test4.step(function() {
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
var controller;
var rs = new ReadableStream({
start: function(c) {
controller = c;
}
});
var counter = 0;
var reader = rs.getReader();
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.read().then(test4.step_func(function() {
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
assert_unreached('read() should reject on an errored stream');
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
}), test4.step_func(function(err) {
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
assert_equals(myError, err);
assert_equals(++counter, 1);
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
}));
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.read().then(test4.step_func(function() {
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
assert_unreached('read() should reject on an errored stream');
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
}), test4.step_func(function(err) {
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
assert_equals(myError, err);
assert_equals(++counter, 2);
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
}));
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
reader.closed.then(test4.step_func(function() {
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
assert_unreached('read() should reject on an errored stream');
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
}), test4.step_func(function(err) {
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
assert_equals(myError, err);
assert_equals(++counter, 3);
test4.done();
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
}));
var myError = { potato: 'mashed' };
controller.error(myError);
});
[Streams API] Sync tests with upstream reference https://bugs.webkit.org/show_bug.cgi?id=148078 Synced with the upstream reference tests. This means that we moved some of ours to the reference and brought some new ones. Of course expectations were updated accordingly. Reviewed by Darin Adler. * streams/readable-stream-controller-error-expected.txt: Expectations. * streams/readable-stream-controller-error.html: Changed test descriptions and moved one test to the reference. * streams/readable-stream-gc-expected.txt: Removed. * streams/readable-stream-gc.html: Moved to the reference. * streams/readable-stream-reader-read-expected.txt: Expectations. * streams/readable-stream-reader-read.html: Moved a test to the reference. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: Expectations. * streams/reference-implementation/readable-stream-reader.html: Brought changes from upstream reference and uncomented async pull source test (which had been commented since a long time ago and is working now). * streams/reference-implementation/readable-stream-tee.html: Brought changes from upstream reference. * streams/reference-implementation/readable-stream-templated-expected.txt: Expectations. * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/readable-stream.html: Brought changes from upstream reference. Canonical link: https://commits.webkit.org/166338@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-20 08:00:43 +00:00
var test5 = async_test('ReadableStream: if start rejects with no parameter, it should error the stream with an undefined error');
[Streams API] Sync tests with spec https://bugs.webkit.org/show_bug.cgi?id=145839 Reviewed by Darin Adler. Considered all changes in the spec tests and brought them to WebKit. Some of those changes were related to spec changes, like the strategy or some of the algorithms. Some like the tee ones were newly added as they will be implemented soon. There are also some tests that shuffled around because they were just moved at the spec or integrated from the changes we submitted, which was substantially important as it allowed us to remove some of our custom tests that are now covered by the spec ones. * resources/gc.js: Added warning about using gcRec, results might not be reliable. * streams/readable-stream-controller-error-expected.txt: * streams/readable-stream-controller-error.html: New failing test due to discrepancies with the reference implementation. Something we will address. * streams/readable-stream-expected.txt: Removed. * streams/readable-stream-gc.html: Renumbered. * streams/readable-stream-reader-expected.txt: Removed. * streams/readable-stream-reader-read.html: Renumbered. * streams/readable-stream-reader.html: Removed. * streams/readable-stream.html: Removed. * streams/reference-implementation/bad-strategies-expected.txt: Added. * streams/reference-implementation/bad-strategies.html: Added. * streams/reference-implementation/bad-underlying-sources-expected.txt: * streams/reference-implementation/bad-underlying-sources.html: Updated from spec and expectations. * streams/reference-implementation/brand-checks-expected.txt: * streams/reference-implementation/brand-checks.html: Updated from spec and expectations. * streams/reference-implementation/byte-length-queuing-strategy-expected.txt: Added. * streams/reference-implementation/byte-length-queuing-strategy.html: Added. * streams/reference-implementation/count-queuing-strategy-expected.txt: * streams/reference-implementation/count-queuing-strategy.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-cancel-expected.txt: * streams/reference-implementation/readable-stream-cancel.html: Updated from spec and expectations and corrected timeouts to try to overcome problems in slower bots. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: * streams/reference-implementation/readable-stream-reader.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream-tee-expected.txt: Added. * streams/reference-implementation/readable-stream-tee.html: Added. * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: Updated from spec and expectations. * streams/reference-implementation/readable-stream.html: Updated from spec and expectations. * streams/reference-implementation/resources/byte-length-queuing-strategy.js: (ByteLengthQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (ByteLengthQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/count-queuing-strategy.js: (CountQueuingStrategy): Updated from spec. (typeIsObject): Deleted. (CountQueuingStrategy.prototype.shouldApplyBackpressure): Deleted. * streams/reference-implementation/resources/streams-utils.js: (RandomPushSource.prototype.readStart.writeChunk): (RandomPushSource.prototype.readStart): Renamed stream as source (.stream.new.ReadableStream): (sequentialReadableStream): Updated from spec. (typeIsObject): Added. (createDataProperty): Added. Canonical link: https://commits.webkit.org/164046@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-06-16 08:19:04 +00:00
test5.step(function() {
var rs = new ReadableStream({
start: function(c) {
return Promise.reject();
}
});
[Streams API] Sync tests with upstream reference https://bugs.webkit.org/show_bug.cgi?id=148078 Synced with the upstream reference tests. This means that we moved some of ours to the reference and brought some new ones. Of course expectations were updated accordingly. Reviewed by Darin Adler. * streams/readable-stream-controller-error-expected.txt: Expectations. * streams/readable-stream-controller-error.html: Changed test descriptions and moved one test to the reference. * streams/readable-stream-gc-expected.txt: Removed. * streams/readable-stream-gc.html: Moved to the reference. * streams/readable-stream-reader-read-expected.txt: Expectations. * streams/readable-stream-reader-read.html: Moved a test to the reference. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: Expectations. * streams/reference-implementation/readable-stream-reader.html: Brought changes from upstream reference and uncomented async pull source test (which had been commented since a long time ago and is working now). * streams/reference-implementation/readable-stream-tee.html: Brought changes from upstream reference. * streams/reference-implementation/readable-stream-templated-expected.txt: Expectations. * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/readable-stream.html: Brought changes from upstream reference. Canonical link: https://commits.webkit.org/166338@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-20 08:00:43 +00:00
rs.getReader().read().catch(test5.step_func(function(e) {
assert_equals(typeof e, "undefined");
[Streams API] Sync tests with upstream reference https://bugs.webkit.org/show_bug.cgi?id=148078 Synced with the upstream reference tests. This means that we moved some of ours to the reference and brought some new ones. Of course expectations were updated accordingly. Reviewed by Darin Adler. * streams/readable-stream-controller-error-expected.txt: Expectations. * streams/readable-stream-controller-error.html: Changed test descriptions and moved one test to the reference. * streams/readable-stream-gc-expected.txt: Removed. * streams/readable-stream-gc.html: Moved to the reference. * streams/readable-stream-reader-read-expected.txt: Expectations. * streams/readable-stream-reader-read.html: Moved a test to the reference. * streams/reference-implementation/readable-stream-expected.txt: * streams/reference-implementation/readable-stream-reader-expected.txt: Expectations. * streams/reference-implementation/readable-stream-reader.html: Brought changes from upstream reference and uncomented async pull source test (which had been commented since a long time ago and is working now). * streams/reference-implementation/readable-stream-tee.html: Brought changes from upstream reference. * streams/reference-implementation/readable-stream-templated-expected.txt: Expectations. * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/readable-stream.html: Brought changes from upstream reference. Canonical link: https://commits.webkit.org/166338@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188684 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-08-20 08:00:43 +00:00
test5.done();
}));
});
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
</script>