Closed Bug 993053 Opened 10 years ago Closed 10 years ago

Add xpc::InitGlobal containing the common code for wrapping main-thread XPConnect and WebIDL globals

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: peterv, Assigned: peterv)

References

Details

Attachments

(1 file)

Attached patch v1 (deleted) — Splinter Review
      No description provided.
Attachment #8402820 - Flags: review?(bobbyholley)
Comment on attachment 8402820 [details] [diff] [review]
v1

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

::: js/xpconnect/src/nsXPConnect.cpp
@@ +406,5 @@
> +    // create ends up there.
> +    JSAutoCompartment ac(aJSContext, aGlobal);
> +    if (!(aFlags & nsIXPConnect::OMIT_COMPONENTS_OBJECT)) {
> +        // XPCCallContext gives us an active request needed to save/restore.
> +        if (!GetCompartmentPrivate(aGlobal)->scope->AttachComponentsObject(aJSContext) ||

Preexisting, I guess, but do we know that the private already exists, or should this use EnsureCompartmentPrivate?

@@ +414,5 @@
> +    }
> +
> +    // Stuff coming through this path always ends up as a DOM global.
> +    // XXX Someone who knows why we can assert this should re-check
> +    //     (after bug 720580).

Remove this comment while you're here, bholley confirmed that the assertion is correct back in the day, but I never got around to removing it again.
Comment on attachment 8402820 [details] [diff] [review]
v1

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

r=bholley

::: js/xpconnect/src/nsXPConnect.cpp
@@ +406,5 @@
> +    // create ends up there.
> +    JSAutoCompartment ac(aJSContext, aGlobal);
> +    if (!(aFlags & nsIXPConnect::OMIT_COMPONENTS_OBJECT)) {
> +        // XPCCallContext gives us an active request needed to save/restore.
> +        if (!GetCompartmentPrivate(aGlobal)->scope->AttachComponentsObject(aJSContext) ||

We do know. XPCWrappedNativeScope creates it in the constructor.
Attachment #8402820 - Flags: review?(bobbyholley) → review+
https://hg.mozilla.org/mozilla-central/rev/1888dccad4f7
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: