-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need to define global used to create the ArrayBuffer and Uint8Array in TextEncoder's encode() #150
Comments
For what it's worth, the TextEncoderStream test expects the Uint8Array to be created in the realm of the constructor: https://github.com/GoogleChromeLabs/text-encode-transform-prollyfill/blob/master/tests/realms.html#L190 For the algorithm for TextEncoderStream I've just copied the equivalent text from TextEncoder. |
Can you link to that, please? |
It's not landed yet: https://github.com/whatwg/encoding/pull/149/files#diff-ad08a062fe2c5f5084f74638410187daR1664 The TextEncoder step I copied it from: https://encoding.spec.whatwg.org/#ref-for-finished%E2%91%A1 |
OK, that wording assumes there is a current Realm. It's not clear to me whether that's true in the streams case, esp. because the algorithm in question is being called async (unlike |
This may be an unintended side-effect of supplying the CreateTransformStream() operation for specs to use rather than expecting them to create a transformer object and pass it to the TransformStream constructor. I'd like the realm used to be the realm of the constructor, because that's what the polyfill does, and I've convinced myself that behaviour is correct. Can you propose some wording that would make it unambiguous? |
I'm not sure what the state of the art is right now for wording for this sort of thing in a non-ecmaspeak context when creating an ES object. @domenic do you know where things stand with that? If I had to make up something, I would just say to create an ArrayBuffer using the constructor from global X and then create a Uint8Array using the constructor from global X or something, since those constructors have no side-effects, this is more or less ok. |
I think we've been even a bit less precise, saying "create an ArrayBuffer in realm X". The hope is to eventually formalize object creation in whatwg/webidl#135. (However that thread says "relevant", which I have an incoming comment on...) |
Firefox and Chrome seem to use the current global. Safari seems to use the relevant global. Edge doesn't implement this API.
The text was updated successfully, but these errors were encountered: