Closed Bug 792890 Opened 8 years ago Closed 8 years ago

Fix JS-wrapping for callback interfaces to comply with the spec

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

Per spec, we should be "wrapping" callback interfaces to the underlying JS object, not double-wrapping in an XPCWrappedNative as we do now.
1) When wrapping a callback interface object for JS, just extract the
   underlying JSObject from inside it and hand that object out.

2) Flag callback interface descriptors as "not concrete" (only matters
   for cases when they have constants on the interface object) and not
   wrappercached (will catch bugs if someone tries to treat them as a
   Gecko object).

3) Fix a preexisting bug in sequence wrapping where we'd try to
   JS_DefineElement twice if we were wrapping a null value for a
   sequence of nullable interface objects.
Attachment #663060 - Flags: review?(peterv)
Comment on attachment 663060 [details] [diff] [review]
Fix JS-wrapping of callback interfaces to just return the underlying JS object.   are several changes here:

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

::: dom/bindings/Codegen.py
@@ +2658,5 @@
> +  } while (0);
> +  if (!JS_DefineElement(cx, returnArray, i, tmp,
> +                        nullptr, nullptr, JSPROP_ENUMERATE)) {
> +    return false;
> +  }  

Trailing whitespace
Blocks: 617532
Attachment #663060 - Flags: review?(jst)
Comment on attachment 663060 [details] [diff] [review]
Fix JS-wrapping of callback interfaces to just return the underlying JS object.   are several changes here:

Looks good, r=jst
Attachment #663060 - Flags: review?(jst) → review+
Attachment #663060 - Flags: review?(peterv)
http://hg.mozilla.org/mozilla-central/rev/2803709dc340
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla19
https://hg.mozilla.org/mozilla-central/rev/2803709dc340
Status: NEW → RESOLVED
Closed: 8 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.