Last Comment Bug 785188 - Make Xrays work with newest DOM list bindings
: Make Xrays work with newest DOM list bindings
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: XPConnect (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla17
Assigned To: Peter Van der Beken [:peterv]
:
Mentors:
Depends on:
Blocks: 753517
  Show dependency treegraph
 
Reported: 2012-08-23 12:30 PDT by Peter Van der Beken [:peterv]
Modified: 2012-08-24 20:05 PDT (History)
1 user (show)
bzbarsky: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
v1 (12.55 KB, patch)
2012-08-23 12:30 PDT, Peter Van der Beken [:peterv]
mrbkap: review+
Details | Diff | Review
v1.1 (14.16 KB, patch)
2012-08-23 17:01 PDT, Peter Van der Beken [:peterv]
peterv: review+
Details | Diff | Review

Description Peter Van der Beken [:peterv] 2012-08-23 12:30:28 PDT
Created attachment 654739 [details] [diff] [review]
v1
Comment 1 Blake Kaplan (:mrbkap) (please use needinfo!) 2012-08-23 13:48:02 PDT
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.
Comment 2 Peter Van der Beken [:peterv] 2012-08-23 17:01:41 PDT
Created attachment 654851 [details] [diff] [review]
v1.1
Comment 3 Boris Zbarsky [:bz] (Out June 25-July 6) 2012-08-23 17:51:16 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/8ba35e8d4457
Comment 4 Ryan VanderMeulen [:RyanVM] 2012-08-24 20:05:00 PDT
https://hg.mozilla.org/mozilla-central/rev/8ba35e8d4457

Note You need to log in before you can comment on or make changes to this bug.