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-27 18:27:26 -07:00
parent 061514d5c1
commit 833b734f38
2 changed files with 3 additions and 10 deletions

View File

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

View File

@ -3722,13 +3722,9 @@ public:
NS_DECL_NSISECURITYCHECKEDCOMPONENT NS_DECL_NSISECURITYCHECKEDCOMPONENT
public: 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 static JSBool
AttachComponentsObject(XPCCallContext& ccx, AttachComponentsObject(XPCCallContext& ccx,
XPCWrappedNativeScope* aScope, XPCWrappedNativeScope* aScope);
JSObject* aTarget = NULL);
void SystemIsBeingShutDown() {ClearMembers();} void SystemIsBeingShutDown() {ClearMembers();}