Bug 159871 - [Streams API] ReadableStreamController methods should throw if its stream is not readable
Summary: [Streams API] ReadableStreamController methods should throw if its stream is ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks: 138561
  Show dependency treegraph
 
Reported: 2016-07-18 00:57 PDT by youenn fablet
Modified: 2016-07-19 10:28 PDT (History)
4 users (show)

See Also:


Attachments
Patch (7.55 KB, patch)
2016-07-18 01:02 PDT, youenn fablet
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews117 for mac-yosemite (1.54 MB, application/zip)
2016-07-18 01:42 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews121 for ios-simulator-wk2 (739.02 KB, application/zip)
2016-07-18 01:43 PDT, Build Bot
no flags Details
Patch (10.91 KB, patch)
2016-07-19 00:47 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Rebasing tests according whatwg (11.27 KB, patch)
2016-07-19 09:19 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2016-07-18 00:57:25 PDT
As per the spec, close and enqueue are aligned with error method. They should throw if stream is not readable.
Comment 1 youenn fablet 2016-07-18 01:02:03 PDT
Created attachment 283889 [details]
Patch
Comment 2 Build Bot 2016-07-18 01:42:07 PDT
Comment on attachment 283889 [details]
Patch

Attachment 283889 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1700405

New failing tests:
streams/reference-implementation/readable-stream-templated.html
streams/reference-implementation/pipe-to-options.html
Comment 3 Build Bot 2016-07-18 01:42:09 PDT
Created attachment 283892 [details]
Archive of layout-test-results from ews117 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 4 Build Bot 2016-07-18 01:43:08 PDT
Comment on attachment 283889 [details]
Patch

Attachment 283889 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1700407

New failing tests:
streams/reference-implementation/readable-stream-templated.html
streams/reference-implementation/pipe-to-options.html
Comment 5 Build Bot 2016-07-18 01:43:10 PDT
Created attachment 283893 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.5
Comment 6 youenn fablet 2016-07-19 00:47:55 PDT
Created attachment 283984 [details]
Patch
Comment 7 youenn fablet 2016-07-19 00:49:03 PDT
(In reply to comment #4)
> Comment on attachment 283889 [details]
> Patch
> 
> Attachment 283889 [details] did not pass ios-sim-ews (ios-simulator-wk2):
> Output: http://webkit-queues.webkit.org/results/1700407
> 
> New failing tests:
> streams/reference-implementation/readable-stream-templated.html
> streams/reference-implementation/pipe-to-options.html

Fixed failures for these tests.
Note that pipeTo is still in flux.
These tests should probably be tightened/updated once pipeTo is finalised.
Comment 8 Xabier Rodríguez Calvar 2016-07-19 04:05:40 PDT
Comment on attachment 283984 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=283984&action=review

> LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt:6
> +CONSOLE MESSAGE: line 405: TypeError: ReadableStream is not readable
> +CONSOLE MESSAGE: line 405: TypeError: ReadableStream is not readable
> +CONSOLE MESSAGE: line 406: TypeError: ReadableStream is not readable
> +CONSOLE MESSAGE: line 406: TypeError: ReadableStream is not readable
> +
> +Harness Error (FAIL), message = TypeError: ReadableStream is not readable

Why does this happen? Can you point the affected tests?
Comment 9 youenn fablet 2016-07-19 04:53:10 PDT
(In reply to comment #8)
> Comment on attachment 283984 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=283984&action=review
> 
> > LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt:6
> > +CONSOLE MESSAGE: line 405: TypeError: ReadableStream is not readable
> > +CONSOLE MESSAGE: line 405: TypeError: ReadableStream is not readable
> > +CONSOLE MESSAGE: line 406: TypeError: ReadableStream is not readable
> > +CONSOLE MESSAGE: line 406: TypeError: ReadableStream is not readable
> > +
> > +Harness Error (FAIL), message = TypeError: ReadableStream is not readable
> 
> Why does this happen? Can you point the affected tests?

This happens twice for the same templated test that tries to asynchronously enqueue and then close the stream (two chunks enqueued async, then closed).

But pipeTo already closed the stream in two cases, hence why enqueue and close are throwing for those configurations.
I would probably be nicer to add some assert_throw but I am not sure this is worth it.
These tests with these console messages exercice well whether the stream is closed or not.
Comment 10 Xabier Rodríguez Calvar 2016-07-19 08:30:40 PDT
Comment on attachment 283984 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=283984&action=review

>>> LayoutTests/streams/reference-implementation/readable-stream-templated-expected.txt:6
>>> +Harness Error (FAIL), message = TypeError: ReadableStream is not readable
>> 
>> Why does this happen? Can you point the affected tests?
> 
> This happens twice for the same templated test that tries to asynchronously enqueue and then close the stream (two chunks enqueued async, then closed).
> 
> But pipeTo already closed the stream in two cases, hence why enqueue and close are throwing for those configurations.
> I would probably be nicer to add some assert_throw but I am not sure this is worth it.
> These tests with these console messages exercice well whether the stream is closed or not.

Sorry, I repent the r+ :), the problem with this output is that you don't know which test is causing that output, I think that needs to be changed.
Comment 11 youenn fablet 2016-07-19 08:58:41 PDT
I'll update the test according what repo test then.
Might be good to move these to W3C WPT repo also.
Do you remember why they were not migrated?
Comment 12 Xabier Rodríguez Calvar 2016-07-19 09:17:48 PDT
(In reply to comment #11)
> I'll update the test according what repo test then.

Good.

> Might be good to move these to W3C WPT repo also.

It would be good.

> Do you remember why they were not migrated?

IIRC, Domenic only migrated some tests and if some of them were not finished it was either because of lack of time (I think he began with "stable" RS features and left WR and friends out) or because things were not stable enough.
Comment 13 youenn fablet 2016-07-19 09:19:00 PDT
Created attachment 284013 [details]
Rebasing tests according whatwg
Comment 14 Xabier Rodríguez Calvar 2016-07-19 10:22:37 PDT
Comment on attachment 284013 [details]
Rebasing tests according whatwg

View in context: https://bugs.webkit.org/attachment.cgi?id=284013&action=review

> LayoutTests/streams/reference-implementation/readable-stream-templated.html:407
> +                if (!this._cancelled)
> +                    c.enqueue(chunks[0]);

Though it might be interesting to check that the exception is being thrown here, this is checked in other places so it is not strictly necessary. Feel free to add it if you feel like.
Comment 15 youenn fablet 2016-07-19 10:27:11 PDT
(In reply to comment #14)
> Comment on attachment 284013 [details]
> Rebasing tests according whatwg
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=284013&action=review
> 
> > LayoutTests/streams/reference-implementation/readable-stream-templated.html:407
> > +                if (!this._cancelled)
> > +                    c.enqueue(chunks[0]);
> 
> Though it might be interesting to check that the exception is being thrown
> here, this is checked in other places so it is not strictly necessary. Feel
> free to add it if you feel like.

Thanks for the review.
I prefer keeping close to the original tests here.
Comment 16 WebKit Commit Bot 2016-07-19 10:28:28 PDT
Comment on attachment 284013 [details]
Rebasing tests according whatwg

Clearing flags on attachment: 284013

Committed r203411: <http://trac.webkit.org/changeset/203411>
Comment 17 WebKit Commit Bot 2016-07-19 10:28:32 PDT
All reviewed patches have been landed.  Closing bug.