https://bugs.webkit.org/show_bug.cgi?id=152505
Reviewed by Youenn Fablet.
LayoutTests/imported/w3c:
Updated imported spec tests.
* web-platform-tests/streams-api/README.txt: Updated spec version.
* web-platform-tests/streams-api/readable-streams/bad-strategies-expected.txt: Expectations.
* web-platform-tests/streams-api/readable-streams/bad-strategies.js: Added two new tests.
Source/WebCore:
This commit fixes last spec change done in
https://github.com/whatwg/streams/commit/
4ba861e6f60c248060811830e11271c84b439cc3.
Test: imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies.html
* Modules/streams/ReadableStreamInternals.js:
(enqueueInReadableStream): Call @errorReadableStream only if state is readable.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194391
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-12-23 Xabier Rodriguez Calvar <calvaris@igalia.com>
+
+ [Streams API] In RS during enqueuing error should be reported only if readable
+ https://bugs.webkit.org/show_bug.cgi?id=152505
+
+ Reviewed by Youenn Fablet.
+
+ Updated imported spec tests.
+
+ * web-platform-tests/streams-api/README.txt: Updated spec version.
+ * web-platform-tests/streams-api/readable-streams/bad-strategies-expected.txt: Expectations.
+ * web-platform-tests/streams-api/readable-streams/bad-strategies.js: Added two new tests.
+
2015-12-21 Xabier Rodriguez Calvar <calvaris@igalia.com>
[Streams API] imported/w3c/web-platform-tests/streams-api/readable-streams/cancel.html has a flaky test
There is a plan to move these tests to web-platform-tests repository so from that moment on this importation will be
automatic.
-Current version: https://github.com/whatwg/streams/tree/f7cb0eac03e6a6d045d6e8c09df1f9f8a264fdef/reference-implementation/web-platform-tests.
+Current version: https://github.com/whatwg/streams/tree/2e7f87e45806d58114592c923aed299798d10161/reference-implementation/web-platform-tests.
PASS Readable stream: throwing strategy.size getter
+PASS Readable stream: strategy.size errors the stream and then throws
+PASS Readable stream: strategy.size errors the stream and then returns Infinity
PASS Readable stream: throwing strategy.size method
PASS Readable stream: throwing strategy.highWaterMark getter
PASS Readable stream: invalid strategy.highWaterMark
new ReadableStream({}, {
get size() {
..." threw object "ReferenceError: Can't find variable: ReadableStream" ("ReferenceError") expected object "Error: a unique string" ("Error")
+FAIL Readable stream: strategy.size errors the stream and then throws Can't find variable: ReadableStream
+FAIL Readable stream: strategy.size errors the stream and then returns Infinity Can't find variable: ReadableStream
FAIL Readable stream: throwing strategy.size method Can't find variable: ReadableStream
FAIL Readable stream: throwing strategy.highWaterMark getter assert_throws: construction should re-throw the error function "() => {
new ReadableStream({}, {
}, 'Readable stream: throwing strategy.size getter');
+test(() => {
+
+ const theError = new Error('a unique string');
+
+ let controller;
+ const rs = new ReadableStream(
+ {
+ start(c) {
+ controller = c;
+ }
+ },
+ {
+ size() {
+ controller.error(theError);
+ throw theError;
+ },
+ highWaterMark: 5
+ }
+ );
+
+ assert_throws(theError, () => {
+ controller.enqueue('a');
+ }, 'enqueue should re-throw the error');
+
+}, 'Readable stream: strategy.size errors the stream and then throws');
+
+test(() => {
+
+ const theError = new Error('a unique string');
+
+ let controller;
+ const rs = new ReadableStream(
+ {
+ start(c) {
+ controller = c;
+ }
+ },
+ {
+ size() {
+ controller.error(theError);
+ return Infinity;
+ },
+ highWaterMark: 5
+ }
+ );
+
+ try {
+ controller.enqueue('a');
+ } catch (error) {
+ assert_equals(error.name, 'RangeError', 'enqueue should throw a RangeError');
+ }
+
+}, 'Readable stream: strategy.size errors the stream and then returns Infinity');
+
promise_test(() => {
const theError = new Error('a unique string');
+2015-12-23 Xabier Rodriguez Calvar <calvaris@igalia.com>
+
+ [Streams API] In RS during enqueuing error should be reported only if readable
+ https://bugs.webkit.org/show_bug.cgi?id=152505
+
+ Reviewed by Youenn Fablet.
+
+ This commit fixes last spec change done in
+ https://github.com/whatwg/streams/commit/4ba861e6f60c248060811830e11271c84b439cc3.
+
+ Test: imported/w3c/web-platform-tests/streams-api/readable-streams/bad-strategies.html
+
+ * Modules/streams/ReadableStreamInternals.js:
+ (enqueueInReadableStream): Call @errorReadableStream only if state is readable.
+
2015-12-23 Chris Aljoudi <chris@chrismatic.io> and Alex Christensen <achristensen@webkit.org>
Content blockers should be able to promote http to https
@enqueueValueWithSize(stream.@queue, chunk, size);
}
catch(error) {
- @errorReadableStream(stream, error);
+ if (stream.@state === @streamReadable)
+ @errorReadableStream(stream, error);
throw error;
}
@requestReadableStreamPull(stream);