Closed Bug 697351 Opened 10 years ago Closed 10 years ago

Implement a has() trap on nodelist that doesn't involve dealing with property descriptors

Categories

(Core :: DOM: Core & HTML, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Keywords: perf)

Attachments

(1 file)

As the summary says.
Comment on attachment 569610 [details] [diff] [review]
Implement has() on the nodelist proxy handler so that we don't have to do the property descriptor song and dance for it.

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

::: js/xpconnect/src/dombindings.cpp
@@ +821,5 @@
> +    JSBool protoHasProp;
> +    bool ok = JS_HasPropertyById(cx, proto, id, &protoHasProp);
> +    if (ok)
> +        *bp = protoHasProp;
> +    return ok;

Isn't it fine to do

  return JS_HasPropertyById(cx, proto, id, bp);

?
Attachment #569610 - Flags: review?(peterv) → review+
> Isn't it fine to do

Sadly, no.  That's what I wrote first, but bp is a bool* and JS_HasPropertyById has JSBool* as its last argument, and the two are not compatible.
http://hg.mozilla.org/integration/mozilla-inbound/rev/2fef1412e0e8

Thanks for the fast review!
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla10
https://hg.mozilla.org/mozilla-central/rev/8f1b74f0b569
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.