Closed Bug 785188 Opened 7 years ago Closed 7 years ago

Make Xrays work with newest DOM list bindings

Categories

(Core :: XPConnect, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla17

People

(Reporter: peterv, Assigned: peterv)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached patch v1 (obsolete) — Splinter Review
No description provided.
Attachment #654739 - Flags: review?(mrbkap)
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+
Attached patch v1.1Splinter Review
Attachment #654739 - Attachment is obsolete: true
Attachment #654851 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/8ba35e8d4457
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.