Closed
Bug 852350
Opened 11 years ago
Closed 11 years ago
Support [Pref=foo] decorator on interfaces
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla22
People
(Reporter: rillian, Assigned: rillian)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file, 2 obsolete files)
3.80 KB,
patch
|
Details | Diff | Splinter Review |
Doing the webidl bindings for the TextTrack* object hierarchy in bug 833385, it struck me as better to use the [Pref="media.webvtt.enabled"] decorator to hide the new api behind a preference, rather than [PrefControlled] which requires every wrapped class to export a PrefEnabled() method. Currently [Pref] only works on individual properties, not interfaces. This bug proposes to add support for that, generating code to check the preference directly in the binding.
Assignee | ||
Comment 1•11 years ago
|
||
Checkpointing work for the day. New code generator isn't called.
Assignee: nobody → giles
Comment 2•11 years ago
|
||
For what it's worth, in for web audio stuff Ehsan just inherited all the classes from one base class that had a static PrefControlled() method on it, and that worked pretty well. Not that I mind having a way to do this from codegen directly.
Assignee | ||
Comment 3•11 years ago
|
||
Thanks for the feedback. I did see ehsan's solution.
Assignee | ||
Comment 4•11 years ago
|
||
Updated patch. Removed bug prints and advertise the new binding method in the dom object descriptor. Verified to work with the webvtt integration branch. Are there tests I should be adding to?
Attachment #726423 -
Attachment is obsolete: true
Attachment #726975 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 5•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=c79ec6d1fdb5
Comment 6•11 years ago
|
||
Comment on attachment 726975 [details] [diff] [review] enable Pref decorator on interfaces >+ def declare(self): >+ return CGAbstractMethod.declare(self) >+ >+ def define(self): >+ return CGAbstractMethod.define(self) Just remove all that: if you're not modifying the base class behavior there's no need to override it either. >+ return " return Preferences::GetBool(\"%s\");" % pref[0] Is it worth using a bool var cache? I guess this is OK for now until we hit a case where we need the performance... Also, this should probably assert that isinstance(pref, list) and len(pref) == 1. >+ and desc.interface.getExtendedAttribute("Pref") is None): I'd prefer the "and" at the end of the previous line. r=me. Are you going to update the docs after I land, or should I?
Attachment #726975 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 7•11 years ago
|
||
Updated patch addressing review comments. > Just remove all that: if you're not modifying the base class behavior there's > no need to override it either. Done. >>+ return " return Preferences::GetBool(\"%s\");" % pref[0] > > Is it worth using a bool var cache? I guess this is OK for now until we hit > a case where we need the performance... I mostly seems to be called on document load, so I think this is fine for now. > Also, this should probably assert that isinstance(pref, list) and len(pref) == 1. Good point. Assumptions are now explicit. > I'd prefer the "and" at the end of the previous line. Fixed. > Are you going to update the docs after I land, or should I? I'm happy to update them. Is it just https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings ?
Attachment #726975 -
Attachment is obsolete: true
Assignee | ||
Comment 8•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/6873f9a7c4d6
Assignee | ||
Comment 9•11 years ago
|
||
I've updated https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#.5BPref.3Dprefname.5D
Comment 11•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6873f9a7c4d6
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•