From 35f4a1d02f16994d95a0d263f31e46255f31e0d6 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 25 Oct 2012 17:01:09 +0200 Subject: [PATCH] Bug 797821 - Remove the XPConnect Compartment Set. r=mrbkap --- js/xpconnect/src/XPCJSRuntime.cpp | 8 -------- js/xpconnect/src/nsXPConnect.cpp | 5 ----- js/xpconnect/src/xpcprivate.h | 10 ---------- 3 files changed, 23 deletions(-) diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index f72a2a261473..28b0b19e1f60 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -240,16 +240,11 @@ CompartmentDestroyedCallback(JSFreeOp *fop, JSCompartment *compartment) XPCJSRuntime* self = nsXPConnect::GetRuntimeInstance(); if (!self) return; - XPCCompartmentSet &set = self->GetCompartmentSet(); // Get the current compartment private into an AutoPtr (which will do the // cleanup for us), and null out the private (which may already be null). nsAutoPtr priv(GetCompartmentPrivate(compartment)); JS_SetCompartmentPrivate(compartment, nullptr); - - if (set.has(compartment)) - set.remove(compartment); - return; } nsresult @@ -2421,8 +2416,6 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect) mJSHolders.Init(512); - mCompartmentSet.init(); - // Install a JavaScript 'debugger' keyword handler in debug builds only #ifdef DEBUG if (!JS_GetGlobalDebugHooks(mJSRuntime)->debuggerHandler) @@ -2466,7 +2459,6 @@ XPCJSRuntime::newXPCJSRuntime(nsXPConnect* aXPConnect) self->GetNativeScriptableSharedMap() && self->GetDyingWrappedNativeProtoMap() && self->GetMapLock() && - self->GetCompartmentSet().initialized() && self->mWatchdogThread) { return self; } diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index 5fa0b058903d..773f79b89457 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -1092,11 +1092,6 @@ CreateGlobalObject(JSContext *cx, JSClass *clasp, nsIPrincipal *principal) // The constructor automatically attaches the scope to the compartment private // of |global|. (void) new XPCWrappedNativeScope(cx, global); - JSCompartment *compartment = js::GetObjectCompartment(global); - - XPCCompartmentSet& set = nsXPConnect::GetRuntimeInstance()->GetCompartmentSet(); - if (!set.put(compartment)) - return nullptr; #ifdef DEBUG // Verify that the right trace hook is called. Note that this doesn't diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index c827e8303dfa..8be33a12a5e7 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -267,12 +267,6 @@ extern const char XPC_SCRIPT_ERROR_CONTRACTID[]; extern const char XPC_ID_CONTRACTID[]; extern const char XPC_XPCONNECT_CONTRACTID[]; -typedef js::HashSet, - js::SystemAllocPolicy> XPCCompartmentSet; - -typedef XPCCompartmentSet::Range XPCCompartmentRange; - /***************************************************************************/ // Useful macros... @@ -718,9 +712,6 @@ public: XPCWrappedNativeProtoMap* GetDetachedWrappedNativeProtoMap() const {return mDetachedWrappedNativeProtoMap;} - XPCCompartmentSet& GetCompartmentSet() - {return mCompartmentSet;} - XPCLock* GetMapLock() const {return mMapLock;} JSBool OnJSContextNew(JSContext* cx); @@ -958,7 +949,6 @@ private: XPCNativeScriptableSharedMap* mNativeScriptableSharedMap; XPCWrappedNativeProtoMap* mDyingWrappedNativeProtoMap; XPCWrappedNativeProtoMap* mDetachedWrappedNativeProtoMap; - XPCCompartmentSet mCompartmentSet; XPCLock* mMapLock; PRThread* mThreadRunningGC; nsTArray mWrappedJSToReleaseArray;