Bug 146408 - [Streams API] Finish pulling must always be done asynchronously as it is the expected promise behavior (according to the spec)
Summary: [Streams API] Finish pulling must always be done asynchronously as it is the ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Xabier Rodríguez Calvar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-29 05:39 PDT by Xabier Rodríguez Calvar
Modified: 2015-06-30 02:54 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.76 KB, patch)
2015-06-29 05:42 PDT, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff
Patch (3.72 KB, patch)
2015-06-29 11:03 PDT, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff
Patch for landing (3.86 KB, patch)
2015-06-30 02:29 PDT, 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-06-29 05:39:19 PDT
[Streams API] Fix readable-stream pull test
Comment 1 Xabier Rodríguez Calvar 2015-06-29 05:42:47 PDT
Created attachment 255745 [details]
Patch

Add a delay to simulate the promise resolution
Comment 2 youenn fablet 2015-06-29 06:57:05 PDT
Comment on attachment 255745 [details]
Patch

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

> Source/WebCore/Modules/streams/ReadableStream.cpp:142
> +            finishPulling();

Sounds good to me. I wonder whether this is necessary for native sources though.

The same principle might be useful for doCancel as well if that is observable.

Not sure the comment is needed.
Comment 3 Darin Adler 2015-06-29 10:16:00 PDT
Comment on attachment 255745 [details]
Patch

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

> Source/WebCore/Modules/streams/ReadableStream.cpp:139
> +        // We need to post the task to simulate the delay in promise resolution.

I agree that this comment isn’t really all that helpful.

> Source/WebCore/Modules/streams/ReadableStream.cpp:140
> +        RefPtr<ReadableStream> protectedStream(this);

Wait, this is not right. To have this RefPtr do any good we need to capture protectedStream, not this.
Comment 4 Xabier Rodríguez Calvar 2015-06-29 11:03:29 PDT
Created attachment 255760 [details]
Patch

Honored comments in bugzilla
Comment 5 Xabier Rodríguez Calvar 2015-06-29 11:04:42 PDT
(In reply to comment #3)
> > Source/WebCore/Modules/streams/ReadableStream.cpp:139
> > +        // We need to post the task to simulate the delay in promise resolution.
> 
> I agree that this comment isn’t really all that helpful.

I think the comment is helpful, otherwise when reading the code people might think that there is no good reason to do that.

> > Source/WebCore/Modules/streams/ReadableStream.cpp:140
> > +        RefPtr<ReadableStream> protectedStream(this);
> 
> Wait, this is not right. To have this RefPtr do any good we need to capture
> protectedStream, not this.

Good catch, done.
Comment 6 youenn fablet 2015-06-29 11:11:48 PDT
Related to the comment, would changing the name of the bug (and the change log) be sufficient as some lightweight documentation means?
Something like: "[Streams API] Finish pulling must always be done asynchronously"?
Comment 7 Xabier Rodríguez Calvar 2015-06-29 15:11:52 PDT
(In reply to comment #6)
> Related to the comment, would changing the name of the bug (and the change
> log) be sufficient as some lightweight documentation means?
> Something like: "[Streams API] Finish pulling must always be done
> asynchronously"?

That can work, I could do that in the landing latch if Darin gives the r+
Comment 8 Xabier Rodríguez Calvar 2015-06-30 02:29:25 PDT
Created attachment 255816 [details]
Patch for landing
Comment 9 WebKit Commit Bot 2015-06-30 02:54:36 PDT
Comment on attachment 255816 [details]
Patch for landing

Clearing flags on attachment: 255816

Committed r186113: <http://trac.webkit.org/changeset/186113>
Comment 10 WebKit Commit Bot 2015-06-30 02:54:40 PDT
All reviewed patches have been landed.  Closing bug.