Bug 142435

Summary: [Streams API] Closing a ReadableStream should resolve the ready and closed promises
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED WONTFIX    
Severity: Normal CC: benjamin, calvaris, cgarcia
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 141160    
Bug Blocks: 141162    
Attachments:
Description Flags
Patch
none
Switching to postTask
none
Cleaning things none

youenn fablet
Reported 2015-03-07 01:15:42 PST
As per the spec, When close() is called, the stream should be put in closed state. At the same time, the ready and closed promises should be resolved.
Attachments
Patch (8.95 KB, patch)
2015-03-07 01:22 PST, youenn fablet
no flags
Switching to postTask (12.13 KB, patch)
2015-03-09 10:41 PDT, youenn fablet
no flags
Cleaning things (11.82 KB, patch)
2015-03-11 20:30 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2015-03-07 01:22:52 PST
Benjamin Poulain
Comment 2 2015-03-08 21:05:31 PDT
Comment on attachment 248149 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248149&action=review Please poke me on IRC when this is up for review. > Source/WebCore/Modules/streams/ReadableStream.cpp:88 > + callOnMainThread(std::bind(WTF::move(m_closedSuccessCallback))); I am quite confused by this callOnMainThread. Are stream multithread? If you intended to resolve the promise asynchronously, it should be scheduled on the next Microtask, I don't think callOnMainThread() does that. Can you explain this? > Source/WebCore/Modules/streams/ReadableStream.cpp:96 > + if (m_state == State::Closed) > + resolveClosedCallback(); I can't get used to it :) > Source/WebCore/Modules/streams/ReadableStream.cpp:114 > + callOnMainThread(std::bind(WTF::move(m_readyCallback))); Same question for callOnMainThread() > Source/WebCore/bindings/js/JSDOMPromise.h:101 > +inline void DeferredWrapper::resolve<JSC::JSValue>(const JSC::JSValue& value) I would add a resolve() without argument. > LayoutTests/streams/readablestream-start.html:52 > +test1 = async_test('ReadableStream close should fulfill ready and closed promises'); I would like tests for every aspect of the patch, including: -Open a stream, close it. Add a callback for "closed" after a timer. -Open a stream. Add ready callback in response to start. -Open a stream. Add closed callback in response to start. -Verify that neither callback are called synchronously on close. -etc. This is a new feature, we need shitload of tests. The difference between a great feature and a shitty feature is flawless execution and great performance. Having overkill test coverage will give you the flawless execution.
youenn fablet
Comment 3 2015-03-09 10:41:26 PDT
Created attachment 248254 [details] Switching to postTask
youenn fablet
Comment 4 2015-03-09 10:45:32 PDT
Comment on attachment 248149 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248149&action=review >> Source/WebCore/Modules/streams/ReadableStream.cpp:88 >> + callOnMainThread(std::bind(WTF::move(m_closedSuccessCallback))); > > I am quite confused by this callOnMainThread. Are stream multithread? > > If you intended to resolve the promise asynchronously, it should be scheduled on the next Microtask, I don't think callOnMainThread() does that. > > Can you explain this? Right, switching to ScriptExecutionContext::postTask is more appropriate. >> Source/WebCore/bindings/js/JSDOMPromise.h:101 >> +inline void DeferredWrapper::resolve<JSC::JSValue>(const JSC::JSValue& value) > > I would add a resolve() without argument. We will add later on a reject(JSValue) which is actually needed as an error may be anything. This function mirrors that future one. > LayoutTests/streams/readablestream-start.html:53 > +test1.step(function() Agreed. I added some more tests and will continue adding more.
youenn fablet
Comment 5 2015-03-11 20:30:14 PDT
Created attachment 248482 [details] Cleaning things
youenn fablet
Comment 6 2015-05-22 04:48:31 PDT
Wontfix as spec changed and no longer has a ready promise.
Note You need to log in before you can comment on or make changes to this bug.