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
IDL array[]s no longer exist #28
Comments
So the WebIDL that Gecko is actually using for our bindings is using I don't remember if that was just because |
Well, the array stuff was all up in the air for a while. What Gecko actually uses here is:
the In terms of how you would use a |
Now ReSpec has removed array support and fails here:
|
@luser, @bzbarsky, @toji I'd like to find a solution for this and make the spec compliant with modern WebIDL. I think everyone agrees that those types should be converted to Using FrozenArrays is a somewhat-breaking change though, as the arrays being returned so far are not frozen (however, I haven't seen code that requires changing those values around). The alternative would be returning an |
It's quite bad if |
FWIW even with the change that'd still be true in Blink (and WebKit I think) due to how the bindings work, and Gecko already does the caching. I guess it wouldn't hurt to mention this explicitly in prose then. |
I'm not sure what you mean here. Do you mean the value of the That is, are you talking about whether Anyway, my take on how this should work is this:
This will all need to be specified in prose. Whether in step 3 the new FrozenArray uses the same GamepadButton objects as the old one or creates new ones, I don't have a strong view on. That's an API design decision, basically. It's not even clear to me whether the set of buttons can change.
Breaking from which point of view? Spec or implementation? Gecko has been shipping frozen arrays here since https://bugzilla.mozilla.org/show_bug.cgi?id=949682 was fixed back in Firefox 29. I can't tell from code inspection what Blink does. |
I'd meant the former, but what I had in mind was basically what you described in your steps.
Spec. Gecko's been using frozen arrays, but so far there was nothing in the spec saying
At the moment, as far as I can see Blink will always return a new array (so |
Arrays have not existed in the WebIDL spec since 2015, so the Gamepad spec (as well as the accompanying Gamepad Extensions one) were providing invalid IDL definitions. Switch to FrozenArray<T> and clarify in prose that some attributes should be cached by the user agent until new values have to be returned. Fixes w3c#28.
Arrays have not existed in the WebIDL spec since 2015, so the Gamepad spec (as well as the accompanying Gamepad Extensions one) were providing invalid IDL definitions. Switch to FrozenArray<T> and clarify in prose that some attributes should be cached by the user agent until new values have to be returned. Fixes w3c#28.
Regardless of what the spec text has said, I would find it hard to believe that this would actually break any usage in practice, especially given that Gecko's implementation has been doing this since it first shipped. Thanks for cleaning this up! |
As such, this spec has invalid Web IDL. Probably you want to use FrozenArray.
The text was updated successfully, but these errors were encountered: