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();}