From c1f8743e0be647e57fb2cea473445b617d7da359 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Tue, 5 Mar 2013 10:01:59 -0800 Subject: [PATCH] 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. --- js/xpconnect/src/XPCComponents.cpp | 7 ++----- js/xpconnect/src/xpcprivate.h | 6 +----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index ba060e4cdbd..602dde5b89b 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -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); } diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index b9d6efd15ca..73191ed0745 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -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();}