Open
Bug 1049788
Opened 10 years ago
Updated 2 years ago
Support [Pref] on a mixin to mean "[Pref] on all the members of this mixin"
Categories
(Core :: DOM: Bindings (WebIDL), enhancement, P5)
Core
DOM: Bindings (WebIDL)
Tracking
()
REOPENED
People
(Reporter: keeler, Unassigned)
References
Details
See bug 1036546. What we would like to have done is this: (in dom/webidl/Crypto.webidl) #ifndef MOZ_DISABLE_CRYPTOLEGACY [NoInterfaceObject,Pref="dom.unsafe_legacy_crypto.enabled"] interface CryptoLegacy { readonly attribute DOMString version; attribute boolean enableSmartCardEvents; ... }; Crypto implements CryptoLegacy; #endif // !MOZ_DISABLE_CRYPTOLEGACY That didn't seem to work (when the pref was false, the attributes/functions were still present on window.crypto). Instead, this worked: #ifndef MOZ_DISABLE_CRYPTOLEGACY [NoInterfaceObject] interface CryptoLegacy { [Pref="dom.unsafe_legacy_crypto.enabled" readonly attribute DOMString version; [Pref="dom.unsafe_legacy_crypto.enabled" attribute boolean enableSmartCardEvents; ... }; Crypto implements CryptoLegacy; #endif // !MOZ_DISABLE_CRYPTOLEGACY i.e. the pref had to be put on every attribute/function in CryptoLegacy, which is unfortunate.
Comment 1•10 years ago
|
||
> [NoInterfaceObject,Pref="dom.unsafe_legacy_crypto.enabled"]
That's pretty much nonsensical. The Pref annotation on an interface controls visibility of the interface object in global scope (and this is clearly documented, last I checked), but in this case you're saying there is no interface object at all. Arguably, we should fail codegen on this construct.
If you want to control the visibility of properties with a pref, you need to set [Pref] on those properties.
Comment 2•10 years ago
|
||
Ah, bug 921453 covers the codegen issue.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
Comment 3•10 years ago
|
||
And in particular, there are cases in which we want to hide the interface object but still have the interface properties available (e.g. Console), so we don't want to just blindly propagate conditions from the interface to properties.
Comment 4•10 years ago
|
||
It is very suboptimal if one needs to Pref all the properties on an [NoInterface] interface.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Comment 5•10 years ago
|
||
Another solution could be to support Pref with 'implements'.
Updated•10 years ago
|
Summary: setting a pref to enable/disable a webidl interface doesn't appear to work as expected → setting a pref to enable/disable a webidl [NoInterface] interface doesn't appear to work as expected
Comment 6•10 years ago
|
||
> Another solution could be to support Pref with 'implements'.
You can "implements" things that have interface objects, so it doesn't work to do that.
If we had explicit mixin syntax, then it would make sense to have [Pref] on a mixin propagate to all its members, just like [Exposed] behaves on a partial interface. But we don't have that yet (though it's been suggested).
We _could_ have [Pref] on a partial interface propagate to members now, of course.
Comment 7•6 years ago
|
||
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Assignee | ||
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
Updated•5 years ago
|
Component: DOM: Core & HTML → DOM: Bindings (WebIDL)
Summary: setting a pref to enable/disable a webidl [NoInterface] interface doesn't appear to work as expected → Support [Pref] on a mixin to mean "[Pref] on all the members of this mixin"
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•