Make Xrays work with newest DOM list bindings

RESOLVED FIXED in mozilla17

Status

()

Core
XPConnect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: peterv, Assigned: peterv)

Tracking

Trunk
mozilla17
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

5 years ago
Created attachment 654739 [details] [diff] [review]
v1
Attachment #654739 - Flags: review?(mrbkap)
Blocks: 753517
Comment on attachment 654739 [details] [diff] [review]
v1

Review of attachment 654739 [details] [diff] [review]:
-----------------------------------------------------------------

Please add a comment somewhere about why it's safe to resolve named properties on lists. If not, please file a followup bug on making sure that we don't let named properties shadow properties on the prototype chain.

::: js/xpconnect/wrappers/WrapperFactory.cpp
@@ +294,5 @@
>  
>  static XrayType
>  GetXrayType(JSObject *obj)
>  {
> +    if (mozilla::dom::IsDOMObject(obj)) {

Nit: No braces on single-line if.

::: js/xpconnect/wrappers/XrayWrapper.cpp
@@ +1058,5 @@
>      JSObject *obj = getInnerObject(wrapper);
> +    const NativePropertyHooks *nativeHooks = GetDOMClass(obj)->mNativeHooks;
> +
> +    if (nativeHooks->mResolveOwnProperty &&
> +        nativeHooks->mResolveOwnProperty(cx, wrapper, id, set, desc) &&

If resolveOwnProperty returns false, we should treat that as if it threw an exception, and we'll need to propagate it here.

@@ +1083,5 @@
> +    JSObject *obj = getInnerObject(wrapper);
> +    const NativePropertyHooks *nativeHooks = GetDOMClass(obj)->mNativeHooks;
> +
> +    if (nativeHooks->mResolveOwnProperty &&
> +        nativeHooks->mResolveOwnProperty(cx, wrapper, id, set, desc) &&

As you pointed out, it might not make sense to do this here... Isn't it redundant with resolveNativeProperty?

@@ +1120,5 @@
> +    JSObject *obj = getInnerObject(wrapper);
> +    const NativePropertyHooks *nativeHooks = GetDOMClass(obj)->mNativeHooks;
> +
> +    if (nativeHooks->mEnumerateOwnProperties &&
> +        !nativeHooks->mEnumerateOwnProperties(cx, wrapper, props))

If enumerateOwnProperties returns false, we should treat that as if it threw an exception, and we'll need to propagate it here.
Attachment #654739 - Flags: review?(mrbkap) → review+
(Assignee)

Comment 2

5 years ago
Created attachment 654851 [details] [diff] [review]
v1.1
Attachment #654739 - Attachment is obsolete: true
Attachment #654851 - Flags: review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/8ba35e8d4457
Flags: in-testsuite+
Target Milestone: --- → mozilla17
https://hg.mozilla.org/mozilla-central/rev/8ba35e8d4457
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.