Bug 790732 - Remove the aTarget parameter from AttachComponentsObject. r=mrbkap

I added this when I thought we'd be defining Components on an object on the XBL
scope chain. At this point, it's not necessary anymore.
This commit is contained in:
Bobby Holley 2013-03-05 10:01:59 -08:00
parent 4d4265aea5
commit c1f8743e0b
2 changed files with 3 additions and 10 deletions

View File

@ -4837,8 +4837,7 @@ ContentComponentsGetterOp(JSContext *cx, JSHandleObject obj, JSHandleId id,
// static
JSBool
nsXPCComponents::AttachComponentsObject(XPCCallContext& ccx,
XPCWrappedNativeScope* aScope,
JSObject* aTarget)
XPCWrappedNativeScope* aScope)
{
JSObject *components = aScope->GetComponentsJSObject(ccx);
if (!components)
@ -4846,13 +4845,11 @@ nsXPCComponents::AttachComponentsObject(XPCCallContext& ccx,
JSObject *global = aScope->GetGlobalJSObject();
MOZ_ASSERT(js::IsObjectInContextCompartment(global, ccx));
if (!aTarget)
aTarget = global;
jsid id = ccx.GetRuntime()->GetStringID(XPCJSRuntime::IDX_COMPONENTS);
JSPropertyOp getter = AccessCheck::isChrome(global) ? nullptr
: &ContentComponentsGetterOp;
return JS_DefinePropertyById(ccx, aTarget, id, js::ObjectValue(*components),
return JS_DefinePropertyById(ccx, global, id, js::ObjectValue(*components),
getter, nullptr, JSPROP_PERMANENT | JSPROP_READONLY);
}

View File

@ -3718,13 +3718,9 @@ public:
NS_DECL_NSISECURITYCHECKEDCOMPONENT
public:
// The target is the object upon which |Components| will be defined. If
// aTarget is left null, a default object will be computed. This is usually
// the right thing to do.
static JSBool
AttachComponentsObject(XPCCallContext& ccx,
XPCWrappedNativeScope* aScope,
JSObject* aTarget = NULL);
XPCWrappedNativeScope* aScope);
void SystemIsBeingShutDown() {ClearMembers();}