Bug 162556 - [Streams API] Align cancelReadableStream() with spec
Summary: [Streams API] Align cancelReadableStream() with spec
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Romain Bellessort
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-26 07:10 PDT by Romain Bellessort
Modified: 2016-09-28 02:20 PDT (History)
3 users (show)

See Also:


Attachments
Patch (6.31 KB, patch)
2016-09-26 07:23 PDT, Romain Bellessort
no flags Details | Formatted Diff | Diff
Patch (8.62 KB, patch)
2016-09-27 06:11 PDT, Romain Bellessort
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Bellessort 2016-09-26 07:10:29 PDT
cancelReadableStream() behaviour is not fully in line with spec.
Comment 1 Romain Bellessort 2016-09-26 07:23:03 PDT
Created attachment 289827 [details]
Patch
Comment 2 Romain Bellessort 2016-09-26 08:06:15 PDT
Uploaded patches aligns the implementation of cancelReadableStream() with spec. Latest spec in particular defines a private method "cancel" in controller. This method is initialized in privateInitializeReadableStreamDefaultController (ReadableStreamInternals.js). This is similar to what was done for the private method "pull" introduced by latest spec.

The function name (cancelReadableStream) has also been modified to be aligned with spec (readableStreamCancel).
Comment 3 Xabier Rodríguez Calvar 2016-09-27 03:06:09 PDT
Comment on attachment 289827 [details]
Patch

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

> Source/WebCore/Modules/streams/ReadableStreamInternals.js:346
> -function cancelReadableStream(stream, reason)
> +function readableStreamCancel(stream, reason)

Are you planning to rename all methods? I mean not in this patch, but if you plan to rename these methods then I think we can go ahead. Otherwise I would stick to the current naming convention even when it differs from the spec one.
Comment 4 youenn fablet 2016-09-27 03:17:51 PDT
Comment on attachment 289827 [details]
Patch

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

> Source/WebCore/Modules/streams/ReadableStreamInternals.js:86
> +        "use strict";

We will create a different function for each controller.
Can we just create this function once and reuse it?
Something like this.@cancel = @readableStreamDefaultControllerCancel, readableStreamDefaultControllerCancel being defined in ReadableStreamInternals.js.
Comment 5 Romain Bellessort 2016-09-27 03:22:13 PDT
(In reply to comment #3)
> Comment on attachment 289827 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=289827&action=review
> 
> > Source/WebCore/Modules/streams/ReadableStreamInternals.js:346
> > -function cancelReadableStream(stream, reason)
> > +function readableStreamCancel(stream, reason)
> 
> Are you planning to rename all methods? I mean not in this patch, but if you
> plan to rename these methods then I think we can go ahead. Otherwise I would
> stick to the current naming convention even when it differs from the spec
> one.


Yes I am planning to do so. Prior to that, I want to align behaviour of some methods that is not yet fully aligned with spec (as in this patch).
Comment 6 Romain Bellessort 2016-09-27 03:23:42 PDT
(In reply to comment #4)
> Comment on attachment 289827 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=289827&action=review
> 
> > Source/WebCore/Modules/streams/ReadableStreamInternals.js:86
> > +        "use strict";
> 
> We will create a different function for each controller.
> Can we just create this function once and reuse it?
> Something like this.@cancel = @readableStreamDefaultControllerCancel,
> readableStreamDefaultControllerCancel being defined in
> ReadableStreamInternals.js.

Ok I'll do this (and I'll do the same for the similar pull() method).
Comment 7 Romain Bellessort 2016-09-27 06:11:56 PDT
Created attachment 289938 [details]
Patch
Comment 8 Romain Bellessort 2016-09-27 06:42:42 PDT
Comment on attachment 289938 [details]
Patch

The new patch implements the change suggested by Youenn (and applies it to the private "pull" method).
Comment 9 Xabier Rodríguez Calvar 2016-09-27 07:25:23 PDT
(In reply to comment #3)
> > Source/WebCore/Modules/streams/ReadableStreamInternals.js:346
> > -function cancelReadableStream(stream, reason)
> > +function readableStreamCancel(stream, reason)
> 
> Are you planning to rename all methods? I mean not in this patch, but if you
> plan to rename these methods then I think we can go ahead. Otherwise I would
> stick to the current naming convention even when it differs from the spec
> one.

You didn't answer this :)
Comment 10 Romain Bellessort 2016-09-27 07:29:18 PDT
(In reply to comment #9)
> (In reply to comment #3)
> > > Source/WebCore/Modules/streams/ReadableStreamInternals.js:346
> > > -function cancelReadableStream(stream, reason)
> > > +function readableStreamCancel(stream, reason)
> > 
> > Are you planning to rename all methods? I mean not in this patch, but if you
> > plan to rename these methods then I think we can go ahead. Otherwise I would
> > stick to the current naming convention even when it differs from the spec
> > one.
> 
> You didn't answer this :)

I replied in comment #5 :) (yes, I am planing to rename all methods) (is it better to reply to multiple comments in a single comment in such cases?)
Comment 11 Xabier Rodríguez Calvar 2016-09-28 00:01:44 PDT
(In reply to comment #10)
> I replied in comment #5 :) (yes, I am planing to rename all methods)

Oh, sorry, my bad, read too quickly.

> (is it
> better to reply to multiple comments in a single comment in such cases?)

You can do as you like.
Comment 12 Xabier Rodríguez Calvar 2016-09-28 00:51:40 PDT
Comment on attachment 289938 [details]
Patch

Romain, I don't see you online so I won't set cq+ until you let me know on IRC.
Comment 13 WebKit Commit Bot 2016-09-28 02:20:18 PDT
Comment on attachment 289938 [details]
Patch

Clearing flags on attachment: 289938

Committed r206508: <http://trac.webkit.org/changeset/206508>
Comment 14 WebKit Commit Bot 2016-09-28 02:20:22 PDT
All reviewed patches have been landed.  Closing bug.