Bug 143564 - [Streams API] ReadableStreamReader should not be exposed
Summary: [Streams API] ReadableStreamReader should not be exposed
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords:
Depends on:
Blocks: 138967
  Show dependency treegraph
 
Reported: 2015-04-09 08:08 PDT by youenn fablet
Modified: 2015-05-28 05:17 PDT (History)
5 users (show)

See Also:


Attachments
Patch (7.02 KB, patch)
2015-04-09 08:11 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-mavericks (565.85 KB, application/zip)
2015-04-09 09:06 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (592.78 KB, application/zip)
2015-04-09 09:12 PDT, Build Bot
no flags Details
Fixing expectations (16.48 KB, patch)
2015-04-09 09:49 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Rebasing according new tests (11.09 KB, patch)
2015-04-12 08:40 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-mavericks (570.29 KB, application/zip)
2015-04-12 09:17 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews104 for mac-mavericks-wk2 (619.10 KB, application/zip)
2015-04-12 09:42 PDT, Build Bot
no flags Details
Fixing expectations (20.40 KB, patch)
2015-04-13 13:34 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Adding NoInterfaceObject to IDL (11.41 KB, patch)
2015-05-26 14:27 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 2015-04-09 08:08:17 PDT
We should set the NoInterfaceObject to ReadableStreamReader as per https://streams.spec.whatwg.org/#globals
Comment 1 youenn fablet 2015-04-09 08:11:18 PDT
Created attachment 250440 [details]
Patch
Comment 2 Build Bot 2015-04-09 09:06:54 PDT
Comment on attachment 250440 [details]
Patch

Attachment 250440 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5129403331772416

New failing tests:
js/dom/global-constructors-attributes.html
Comment 3 Build Bot 2015-04-09 09:06:58 PDT
Created attachment 250441 [details]
Archive of layout-test-results from ews100 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 4 Build Bot 2015-04-09 09:12:30 PDT
Comment on attachment 250440 [details]
Patch

Attachment 250440 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/6013501948559360

New failing tests:
js/dom/global-constructors-attributes.html
Comment 5 Build Bot 2015-04-09 09:12:33 PDT
Created attachment 250442 [details]
Archive of layout-test-results from ews107 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 6 youenn fablet 2015-04-09 09:49:39 PDT
Created attachment 250443 [details]
Fixing expectations
Comment 7 Benjamin Poulain 2015-04-09 21:53:28 PDT
Comment on attachment 250443 [details]
Fixing expectations

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

> Source/WebCore/ChangeLog:9
> +        Made ReadableStreamReader not exposed to JS.
> +        Removed ReadableStreamReader constructor.

What am I missing? https://streams.spec.whatwg.org/#reader-constructor
Comment 8 youenn fablet 2015-04-10 03:45:44 PDT
(In reply to comment #7)
> Comment on attachment 250443 [details]
> Fixing expectations
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=250443&action=review
> 
> > Source/WebCore/ChangeLog:9
> > +        Made ReadableStreamReader not exposed to JS.
> > +        Removed ReadableStreamReader constructor.
> 
> What am I missing? https://streams.spec.whatwg.org/#reader-constructor

Well, the WebIDL spec says that the Constructor keyword should not be used with NoInterfaceObject.
The streams spec says that users should not use the constructor, since there is getReader().
There seems to be little value in keeping it.
But the implementation will also work with the constructor I guess.
Comment 9 youenn fablet 2015-04-12 08:40:45 PDT
Created attachment 250604 [details]
Rebasing according new tests
Comment 10 Build Bot 2015-04-12 09:17:21 PDT
Comment on attachment 250604 [details]
Rebasing according new tests

Attachment 250604 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6053874439815168

New failing tests:
js/dom/global-constructors-attributes.html
Comment 11 Build Bot 2015-04-12 09:17:25 PDT
Created attachment 250606 [details]
Archive of layout-test-results from ews102 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 12 Build Bot 2015-04-12 09:42:46 PDT
Comment on attachment 250604 [details]
Rebasing according new tests

Attachment 250604 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/4545507896590336

New failing tests:
js/dom/global-constructors-attributes.html
Comment 13 Build Bot 2015-04-12 09:42:48 PDT
Created attachment 250609 [details]
Archive of layout-test-results from ews104 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews104  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 14 youenn fablet 2015-04-13 13:34:51 PDT
Created attachment 250672 [details]
Fixing expectations
Comment 15 youenn fablet 2015-04-13 13:43:04 PDT
(In reply to comment #8)
> (In reply to comment #7)
> > Comment on attachment 250443 [details]
> > Fixing expectations
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=250443&action=review
> > 
> > > Source/WebCore/ChangeLog:9
> > > +        Made ReadableStreamReader not exposed to JS.
> > > +        Removed ReadableStreamReader constructor.
> > 
> > What am I missing? https://streams.spec.whatwg.org/#reader-constructor
> 
> Well, the WebIDL spec says that the Constructor keyword should not be used
> with NoInterfaceObject.
> The streams spec says that users should not use the constructor, since there
> is getReader().
> There seems to be little value in keeping it.
> But the implementation will also work with the constructor I guess.

I was wrong.
The binding generator is not generating the constructor property if NoInterfaceObject is set, even if CustomConstructor is set.
Comment 16 Benjamin Poulain 2015-04-14 16:13:20 PDT
Comment on attachment 250672 [details]
Fixing expectations

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

Ok.

> Source/WebCore/ChangeLog:9
> +        Made ReadableStreamReader not exposed to JS.
> +        Removed ReadableStreamReader constructor as the binding generator does not use it when interface is not exposed.

Can you please reference https://streams.spec.whatwg.org/#globals here?

> LayoutTests/js/dom/global-constructors-attributes-expected.txt:-1005
> -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').value is ReadableStreamReader
> -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').hasOwnProperty('get') is false
> -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').hasOwnProperty('set') is false
> -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').enumerable is false
> -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').configurable is true

You could cover this by getting the constructor property of the object you get from getReader().

I think getting enumerable is valuable.

> LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt:-3
> -PASS ReadableStreamReader constructor should get a ReadableStream object as argument 

You need to adapt those tests. 

You could create a new reader after getting the constructor of an existing reader object.

> LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt:9
> +FAIL Constructing a ReadableStreamReader directly should fail if the stream is already locked (via direct construction) assert_throws: constructing directly should fail function "function () { new ReadableStreamReader(rs); }" did not throw
> +FAIL Getting a ReadableStreamReader via getReader should fail if the stream is already locked (via direct construction) assert_throws: getReader() should fail function "function () { rs.getReader(); }" did not throw
> +FAIL Constructing a ReadableStreamReader directly should fail if the stream is already locked (via getReader) assert_throws: constructing directly should fail function "function () { new ReadableStreamReader(rs); }" did not throw

What about those?
Comment 17 youenn fablet 2015-04-15 03:59:17 PDT
(In reply to comment #16)
> Comment on attachment 250672 [details]
> Fixing expectations
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=250672&action=review
> 
> Ok.
> 
> > Source/WebCore/ChangeLog:9
> > +        Made ReadableStreamReader not exposed to JS.
> > +        Removed ReadableStreamReader constructor as the binding generator does not use it when interface is not exposed.
> 
> Can you please reference https://streams.spec.whatwg.org/#globals here?
> 
> > LayoutTests/js/dom/global-constructors-attributes-expected.txt:-1005
> > -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').value is ReadableStreamReader
> > -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').hasOwnProperty('get') is false
> > -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').hasOwnProperty('set') is false
> > -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').enumerable is false
> > -PASS Object.getOwnPropertyDescriptor(global, 'ReadableStreamReader').configurable is true
> 
> You could cover this by getting the constructor property of the object you
> get from getReader().
> 
> I think getting enumerable is valuable.
> 
> > LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt:-3
> > -PASS ReadableStreamReader constructor should get a ReadableStream object as argument 
> 
> You need to adapt those tests. 
> 
> You could create a new reader after getting the constructor of an existing
> reader object.
> 
> > LayoutTests/streams/reference-implementation/readable-stream-reader-expected.txt:9
> > +FAIL Constructing a ReadableStreamReader directly should fail if the stream is already locked (via direct construction) assert_throws: constructing directly should fail function "function () { new ReadableStreamReader(rs); }" did not throw
> > +FAIL Getting a ReadableStreamReader via getReader should fail if the stream is already locked (via direct construction) assert_throws: getReader() should fail function "function () { rs.getReader(); }" did not throw
> > +FAIL Constructing a ReadableStreamReader directly should fail if the stream is already locked (via getReader) assert_throws: constructing directly should fail function "function () { new ReadableStreamReader(rs); }" did not throw
> 
> What about those?

A similar strategy to implement reader constructor could be done as https://bugs.webkit.org/show_bug.cgi?id=143752
That would solve those issues properly.
Can we make that as another patch?
Comment 18 youenn fablet 2015-05-26 14:27:28 PDT
Created attachment 253738 [details]
Adding NoInterfaceObject to IDL
Comment 19 WebKit Commit Bot 2015-05-28 05:17:03 PDT
Comment on attachment 253738 [details]
Adding NoInterfaceObject to IDL

Clearing flags on attachment: 253738

Committed r184955: <http://trac.webkit.org/changeset/184955>
Comment 20 WebKit Commit Bot 2015-05-28 05:17:09 PDT
All reviewed patches have been landed.  Closing bug.