Bug 150667 - [Streams API] Turn WS states into integers and fix state initialization
Summary: [Streams API] Turn WS states into integers and fix state initialization
Status: RESOLVED FIXED
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
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-29 04:21 PDT by Xabier Rodríguez Calvar
Modified: 2015-10-29 09:52 PDT (History)
4 users (show)

See Also:


Attachments
Patch (21.09 KB, patch)
2015-10-29 04:27 PDT, Xabier Rodríguez Calvar
no flags Details | Formatted Diff | Diff
Patch for landing (21.21 KB, patch)
2015-10-29 08:55 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-10-29 04:21:03 PDT
[Streams API] Turn WS states into integers and fix state initialization
Comment 1 Xabier Rodríguez Calvar 2015-10-29 04:27:41 PDT
Created attachment 264311 [details]
Patch

I wasn't sure if I should rework the rs states or keep them separated. I finally decided to go got reworking them though I don't have a string opinion about it. Turned ws states into integer values and also fixed the state not being initialized.
Comment 2 youenn fablet 2015-10-29 05:02:09 PDT
Comment on attachment 264311 [details]
Patch

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

> Source/WebCore/Modules/streams/ReadableStreamInternals.js:-329
> -    // TODO: ASSERT(stream.@state !== @readableStreamErrored);

If we should use FIXME, maybe change the ones that got changed accordingly

> Source/WebCore/Modules/streams/WritableStream.js:195
> +    }

Might want to rewrite this with return and assert(false)

> Source/WebCore/bindings/js/JSDOMWindowBase.cpp:95
> +        GlobalPropertyInfo(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().streamWritablePrivateName(), jsNumber(6), DontDelete | ReadOnly),

Somehow we should automate this private enumeration step.
That said, this seems good enough
Comment 3 Xabier Rodríguez Calvar 2015-10-29 05:21:58 PDT
(In reply to comment #2)
> > Source/WebCore/Modules/streams/ReadableStreamInternals.js:-329
> > -    // TODO: ASSERT(stream.@state !== @readableStreamErrored);
> 
> If we should use FIXME, maybe change the ones that got changed accordingly

I'll change the ones that appear in the patch, but I was planning to do a wider style change so I'll fix the others later.

> > Source/WebCore/Modules/streams/WritableStream.js:195
> > +    }
> 
> Might want to rewrite this with return and assert(false)

I thought of that too, but I liked it more this because assert(false) seems dirty. I could do write assert_not_reached. Please, let me know if you prefer to leave it as it is now or an assert_not_reached.

> > Source/WebCore/bindings/js/JSDOMWindowBase.cpp:95
> > +        GlobalPropertyInfo(static_cast<JSVMClientData*>(vm.clientData)->builtinNames().streamWritablePrivateName(), jsNumber(6), DontDelete | ReadOnly),
> 
> Somehow we should automate this private enumeration step.
> That said, this seems good enough

I thought of that too when I was touching this.
Comment 4 Xabier Rodríguez Calvar 2015-10-29 08:55:49 PDT
Created attachment 264319 [details]
Patch for landing
Comment 5 Xabier Rodríguez Calvar 2015-10-29 09:12:34 PDT
(In reply to comment #3)
> > If we should use FIXME, maybe change the ones that got changed accordingly
> 
> I'll change the ones that appear in the patch, but I was planning to do a
> wider style change so I'll fix the others later.

Changed the ones affected and things around for coherence.

> > > Source/WebCore/Modules/streams/WritableStream.js:195
> > > +    }
> > 
> > Might want to rewrite this with return and assert(false)
> 
> I thought of that too, but I liked it more this because assert(false) seems
> dirty. I could do write assert_not_reached. Please, let me know if you
> prefer to leave it as it is now or an assert_not_reached.

Changed to return with assert_not_reached.
Comment 6 WebKit Commit Bot 2015-10-29 09:52:30 PDT
Comment on attachment 264319 [details]
Patch for landing

Clearing flags on attachment: 264319

Committed r191730: <http://trac.webkit.org/changeset/191730>
Comment 7 WebKit Commit Bot 2015-10-29 09:52:34 PDT
All reviewed patches have been landed.  Closing bug.