Bug 151089 - [Streams API] Fix style issues
Summary: [Streams API] Fix style issues
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Xabier Rodríguez Calvar
Depends on:
Reported: 2015-11-10 04:50 PST by Xabier Rodríguez Calvar
Modified: 2015-11-10 07:45 PST (History)
4 users (show)

See Also:

Patch (19.76 KB, patch)
2015-11-10 04:52 PST, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff
Patch for landing (19.56 KB, patch)
2015-11-10 06:47 PST, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xabier Rodríguez Calvar 2015-11-10 04:50:27 PST
[Streams API] Fix style issues
Comment 1 Xabier Rodríguez Calvar 2015-11-10 04:52:24 PST
Created attachment 265167 [details]

Inlined some things, var -> const and let, removed some undefined parameters and returns, added missing use strict and other minor changes
Comment 2 youenn fablet 2015-11-10 05:39:30 PST
Comment on attachment 265167 [details]

Nice clean-up.
Use of bind() may not be safe.
Would you be able to land the patch without the bind changes.
Doing a quick check, bind seems already in use in WritableStream.
A follow-up should fix that. 

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

> Source/WebCore/Modules/streams/ReadableStream.js:58
> +    @Promise.prototype.@then.@call(@Promise.@resolve(@invokeOrNoop(underlyingSource, "start", [this.@controller])), function() {

This line is rather hard to parse.
I would keep it as two different lines.

> Source/WebCore/Modules/streams/ReadableStreamInternals.js:243
> +    @Promise.prototype.@then.@call(@promiseInvokeOrNoop(stream.@underlyingSource, "pull", [stream.@controller]), function() {


> Source/WebCore/Modules/streams/WritableStreamInternals.js:112
> +        @errorWritableStream.bind(stream)

Using bind may not be safe.
What if someone does Function.prototype.bind = evilFunction?

I would remove the change from this patch.
As a later patch and if that is worth it, @bind may be added and this change may be done.

> Source/WebCore/Modules/streams/WritableStreamInternals.js:129
> +        @errorWritableStream.bind(stream)

Comment 3 Xabier Rodríguez Calvar 2015-11-10 06:47:20 PST
Created attachment 265175 [details]
Patch for landing
Comment 4 WebKit Commit Bot 2015-11-10 07:45:21 PST
Comment on attachment 265175 [details]
Patch for landing

Clearing flags on attachment: 265175

Committed r192246: <http://trac.webkit.org/changeset/192246>
Comment 5 WebKit Commit Bot 2015-11-10 07:45:25 PST
All reviewed patches have been landed.  Closing bug.