Bug 145262 - [Streams API] Implement pulling of a source by a ReadableStream
Summary: [Streams API] Implement pulling of a source by a ReadableStream
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: 145210
Blocks: 138967
  Show dependency treegraph
 
Reported: 2015-05-21 05:18 PDT by youenn fablet
Modified: 2015-06-10 01:11 PDT (History)
3 users (show)

See Also:


Attachments
Patch (15.47 KB, patch)
2015-06-09 01:16 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Rebasing (19.10 KB, patch)
2015-06-09 01:58 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Fixed typo (19.25 KB, patch)
2015-06-09 07:59 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (19.36 KB, patch)
2015-06-09 12:44 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-05-21 05:18:16 PDT
At start time or after reading some data, a ReadableStream may want to pull data from its source until a limit.
This mechanism should be implemented.
Comment 1 youenn fablet 2015-06-09 01:16:50 PDT
Created attachment 254556 [details]
Patch
Comment 2 youenn fablet 2015-06-09 01:58:21 PDT
Created attachment 254557 [details]
Rebasing
Comment 3 youenn fablet 2015-06-09 07:59:33 PDT
Created attachment 254569 [details]
Fixed typo
Comment 4 Darin Adler 2015-06-09 09:49:45 PDT
Comment on attachment 254569 [details]
Fixed typo

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

> Source/WebCore/bindings/js/ReadableJSStream.cpp:108
> +    ExecState& exec= *globalObject()->globalExec();

Missing space here before before the "=" sign. Also, lately I have been thinking we should start using “state” as the name for this rather then “exec”.

> Source/WebCore/bindings/js/ReadableJSStream.cpp:153
> +bool ReadableJSStream::checkForException(JSC::ExecState& exec)

I don’t think the name for this is exactly right; this does more than just “check for” an exception. It moves the exception from the execution state to the stream object. It’s a lot like “store error” in fact. I think maybe the storeError that doesn’t take an argument should just do this if there’s an exception in the exception state.

I also think the idea of having this function do the hadException boolean check is so great. If the caller needs to distinguish that case, I think checking hadException at the call site makes no sense.
Comment 5 youenn fablet 2015-06-09 10:15:49 PDT
Comment on attachment 254569 [details]
Fixed typo

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

>> Source/WebCore/bindings/js/ReadableJSStream.cpp:108
>> +    ExecState& exec= *globalObject()->globalExec();
> 
> Missing space here before before the "=" sign. Also, lately I have been thinking we should start using “state” as the name for this rather then “exec”.

OK

>> Source/WebCore/bindings/js/ReadableJSStream.cpp:153
>> +bool ReadableJSStream::checkForException(JSC::ExecState& exec)
> 
> I don’t think the name for this is exactly right; this does more than just “check for” an exception. It moves the exception from the execution state to the stream object. It’s a lot like “store error” in fact. I think maybe the storeError that doesn’t take an argument should just do this if there’s an exception in the exception state.
> 
> I also think the idea of having this function do the hadException boolean check is so great. If the caller needs to distinguish that case, I think checking hadException at the call site makes no sense.

Initially, I did a first version doing everything in storeError().
The issue is that storeError() will always store an error, even if none is provided, in case of "controller.error()" for instance.
We would need to do twice a exec.hadException() check if doing everything in storeError().

I plan to rewrite this using "void ReadableJSStream::storeException(ExecState&)" in lieu of checkForException.
Please let me know if you have any better idea.
Comment 6 youenn fablet 2015-06-09 12:44:10 PDT
Created attachment 254590 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2015-06-10 01:11:00 PDT
Comment on attachment 254590 [details]
Patch for landing

Clearing flags on attachment: 254590

Committed r185406: <http://trac.webkit.org/changeset/185406>
Comment 8 WebKit Commit Bot 2015-06-10 01:11:05 PDT
All reviewed patches have been landed.  Closing bug.