-
Notifications
You must be signed in to change notification settings - Fork 164
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
How to do aliases of legacy interfaces (HTMLDocument, WebKitCSSMatrix...) #362
Comments
cc @foolip |
See whatwg/url#135 (comment) for other use cases. |
Strawman suggestion:
...with semantics as defined for those right now. Note that the aliases are only on |
|
WFM |
So an alternative could be to use I searched on httparchive, nerdydata.com, github.com, and couldn't find any instance of "WebKitCSSMatrix.prototype" (just 1 in nerdydata that was in a JS comment). Would An alias is probably cleaner, but thought I'd bring this up as a possibility... |
I don't know, Chromium is probably in a better position to answer such questions. |
https://github.com/jarodl/Cartog/blob/261f603dc35f569ee137f83fa8b43b566723dc41/lib/uilayer.js#L766 (But I only found 3 instances of this script on github; nothing in httparchive, nothing in nerdydata.) |
Seeked Chromium opinion in https://codereview.chromium.org/2709763004/#msg81 |
I think that aliases ( It's possible that
There are also a bunch of webkitSpeech*, but they're not only prefixed and use aliases just to keep "webkit" out of most of the code. (You could tell from toString() on the instances of course.) |
OK then.
|
Demo for |
I tried to specify this in #364. I'm not too familiar with adding things to WebIDL so I probably missed something; review welcome! |
Why, exactly? I don't think it would. Instanceof checks compare the proto chain of the LHS to the .prototype of the RHS. So as long as the .prototype values match instanceof will be fine. |
That said, I agree aliases are conceptually cleaner. That said, in implementation terms, I'm not aware of Gecko having any aliases right now, and adding them would be a bit of a pain, so will probably delay us shipping anything that involves aliases a good bit, largely because everyone involved in the bindings layer is currently completely swamped with other things. |
Oh, ok. Then they wouldn't break.
|
So maybe we should hold off until Firefox identifies compatibility pain with not having these aliases? |
Could we have It feels to me like a good compromise between not blocking the implementation and having a cleaner interface in the future. |
I also prefer the LegacyAlias (or LegacyWindowAlias) suggestion. |
@fserb I think it might be the case that Firefox doesn't have these to begin with. E.g., I know for a fact Fx doesn't do |
@annevk Gecko has |
I've learned now that the bindings generator in Chromium for the aliases @foolip mentioned above seems to generate the correct property descriptor. Demo for http://software.hixie.ch/utilities/js/live-dom-viewer/saved/5185 The current IDL in Chromium is an attribute on
|
@annevk, I thought the problem is that it has So that the new |
@fserb yeah, I didn't realize Fx was doing |
@bzbarsky are you good with this approach? If so, I'll go ahead and merge @zcorpan's pull request #364. |
Speccing LegacyWindowAlias sounds fine. I just can't commit to Firefox implementing it in any particular timeframe. |
So we have this in HTML:
https://html.spec.whatwg.org/#htmldocument
The intent here is to expose it in the same way as an actual interface is exposed per WebIDL rules.
This method of aliasing legacy interfaces is also used in the Geometry interfaces spec.
https://drafts.fxtf.org/geometry/#webkitcssmatrix
In implementing this it appears tempting to try to do so via an IDL attribute on
Window
, but that does not have correct behavior (it will have a getter instead of value, it's enumerable, etc). c.f. https://codereview.chromium.org/2709763004/#msg53Should we add dedicated IDL syntax for this?
The text was updated successfully, but these errors were encountered: