Closed
Bug 838691
Opened 12 years ago
Closed 12 years ago
Support calling a function to determine whether a property is defined in a WebIDL binding, not just checking a pref
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla22
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
(Keywords: dev-doc-complete)
Attachments
(5 files, 2 obsolete files)
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
peterv
:
review+
|
Details | Diff | Splinter Review |
Need this for bug 838614.
Assignee | ||
Comment 1•12 years ago
|
||
Attachment #711092 -
Flags: review?(peterv)
Assignee | ||
Comment 2•12 years ago
|
||
Attachment #711093 -
Flags: review?(peterv)
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #711095 -
Flags: review?(peterv)
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #711097 -
Flags: review?(peterv)
Assignee | ||
Comment 5•12 years ago
|
||
Attachment #711098 -
Flags: review?(peterv)
Assignee | ||
Comment 6•12 years ago
|
||
Whiteboard: [need review]
Assignee | ||
Comment 7•12 years ago
|
||
Try run for real: https://tbpl.mozilla.org/?tree=Try&rev=a2d7d23ee48d
Attachment #711129 -
Flags: review?(peterv)
Assignee | ||
Updated•12 years ago
|
Attachment #711095 -
Attachment is obsolete: true
Attachment #711095 -
Flags: review?(peterv)
Assignee | ||
Comment 8•12 years ago
|
||
Try run for real real: https://tbpl.mozilla.org/?tree=Try&rev=1ba85fe2a5dd
Attachment #711136 -
Flags: review?(peterv)
Assignee | ||
Updated•12 years ago
|
Attachment #711129 -
Attachment is obsolete: true
Attachment #711129 -
Flags: review?(peterv)
Comment 9•12 years ago
|
||
Comment on attachment 711092 [details] [diff] [review]
part 1. Add support in Prefable for calling a function to determine whether a property should be exposed in a WebIDL binding.
Review of attachment 711092 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/BindingUtils.cpp
@@ +649,4 @@
> }
>
> static bool
> XrayResolveAttribute(JSContext* cx, JSObject* wrapper, jsid id,
Would it make sense to actually pass in the unwrapped object as |JSObject* obj| here too (we already do that for all the Xray* hooks)?
@@ +901,5 @@
> id, desc);
> }
>
> bool
> +XrayEnumerateAttributes(JSContext* cx, JSObject* wrapper,
Add |JSObject* obj| here too.
@@ +924,5 @@
> return true;
> }
>
> bool
> +XrayEnumerateProperties(JSContext* cx, JSObject* wrapper,
Same here.
@@ +1029,5 @@
> const NativePropertiesHolder& nativeProperties =
> nativePropertyHooks->mNativeProperties;
>
> if (nativeProperties.regular &&
> + !XrayEnumerateProperties(cx, wrapper, flags, props, type,
Pass in obj here.
@@ +1036,5 @@
> }
>
> if (nativeProperties.chromeOnly &&
> xpc::AccessCheck::isChrome(js::GetObjectCompartment(wrapper)) &&
> + !XrayEnumerateProperties(cx, wrapper, flags, props, type,
And here.
::: dom/bindings/DOMJSClass.h
@@ +69,5 @@
> + inline bool isEnabled(JSContext* cx, JSObject* obj) {
> + return enabled &&
> + (!enabledFunc ||
> + enabledFunc(cx, js::GetGlobalForObjectCrossCompartment(obj)));
> +
Trailing whitespace.
Attachment #711092 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 10•12 years ago
|
||
> Would it make sense to actually pass in the unwrapped object as |JSObject* obj| here too
Makes sense. I'll do that.
Comment 11•12 years ago
|
||
Comment on attachment 711093 [details] [diff] [review]
part 2. Add codegen support for calling a function to determine whether a property should be exposed in a WebIDL binding.
Review of attachment 711093 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/BindingUtils.cpp
@@ +716,5 @@
> }
> if (methods) {
> Prefable<JSFunctionSpec>* method;
> for (method = methods; method->specs; ++method) {
> + if (method->isEnabled(cx, js::UnwrapObject(wrapper))) {
If you plan to land these separately you should merge this into part 1.
::: dom/bindings/Codegen.py
@@ +1049,2 @@
> return None
> + # It's a list of strings
Wrong indentation.
::: dom/bindings/DOMJSClass.h
@@ +69,5 @@
> inline bool isEnabled(JSContext* cx, JSObject* obj) {
> return enabled &&
> (!enabledFunc ||
> enabledFunc(cx, js::GetGlobalForObjectCrossCompartment(obj)));
> + }
Again, should probably merge this into part 1.
@@ +76,5 @@
> bool enabled;
> // A function pointer to a function that can say the property is disabled
> // even if "enabled" is set to true. If the pointer is null the value of
> // "enabled" is used as-is.
> + PropertyEnabled enabledFunc;
And this.
Attachment #711093 -
Flags: review?(peterv) → review+
Updated•12 years ago
|
Attachment #711136 -
Flags: review?(peterv) → review+
Updated•12 years ago
|
Attachment #711097 -
Flags: review?(peterv) → review+
Updated•12 years ago
|
Attachment #711098 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 12•12 years ago
|
||
> If you plan to land these separately you should merge this into part 1.
> Again, should probably merge this into part 1.
> And this.
Done locally when addressing the comments for part 1. Sorry I didn't post an updated part 2. :(
> Wrong indentation.
Fixed.
Assignee | ||
Comment 13•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/83952a3e9b74
https://hg.mozilla.org/integration/mozilla-inbound/rev/35231869058a
https://hg.mozilla.org/integration/mozilla-inbound/rev/b5fa1cb51dc8
https://hg.mozilla.org/integration/mozilla-inbound/rev/20931d1439b2
https://hg.mozilla.org/integration/mozilla-inbound/rev/136477aeba1e
Whiteboard: [need review]
Comment 14•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/83952a3e9b74
https://hg.mozilla.org/mozilla-central/rev/35231869058a
https://hg.mozilla.org/mozilla-central/rev/b5fa1cb51dc8
https://hg.mozilla.org/mozilla-central/rev/20931d1439b2
https://hg.mozilla.org/mozilla-central/rev/136477aeba1e
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
Assignee | ||
Comment 15•12 years ago
|
||
Documented at https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings#.5BFunc.3D.22funcname.22.5D
Keywords: dev-doc-complete
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•