Bug 843231 - Move the nulling out of mPrototypeNoHelper from SetGlobal to RemoveWrappedNativeProtos. r=bz
authorBobby Holley <bobbyholley@gmail.com>
Wed, 27 Mar 2013 11:40:40 -0700
changeset 132485 eecd27a6668906eed9a1ed52c4bb49e5a596242a
parent 132484 d9aca7fdb287ec2d9278247ec97553f4325a5052
child 132486 add20e9fce39967ebbeb60dc684112e87a7076bf
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs843231
milestone21.0a2
Bug 843231 - Move the nulling out of mPrototypeNoHelper from SetGlobal to RemoveWrappedNativeProtos. r=bz The only call-site for both of these is JSD->nsXPConnect::InitClasses, so this is equivalent. All this will go away soon anyhow when JSD goes away.
js/xpconnect/src/XPCWrappedNativeScope.cpp
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -289,19 +289,16 @@ js::Class XPC_WN_NoHelper_Proto_JSClass 
 
 void
 XPCWrappedNativeScope::SetGlobal(JSContext *cx, JSObject* aGlobal)
 {
     // We allow for calling this more than once. This feature is used by
     // nsXPConnect::InitClassesWithNewWrappedGlobal.
     mGlobalJSObject = aGlobal;
 
-    // Clear the no helper wrapper prototype object so that a new one
-    // gets created if needed.
-    mPrototypeNoHelper = nullptr;
 }
 
 XPCWrappedNativeScope::~XPCWrappedNativeScope()
 {
     MOZ_COUNT_DTOR(XPCWrappedNativeScope);
     DEBUG_TrackDeleteScope(this);
 
     // We can do additional cleanup assertions here...
@@ -724,16 +721,20 @@ WNProtoRemover(JSDHashTable *table, JSDH
     detachedMap->Add(proto);
 
     return JS_DHASH_REMOVE;
 }
 
 void
 XPCWrappedNativeScope::RemoveWrappedNativeProtos()
 {
+    // Clear the no helper wrapper prototype object so that a new one
+    // gets created if needed.
+    mPrototypeNoHelper = nullptr;
+
     XPCAutoLock al(XPCJSRuntime::Get()->GetMapLock());
 
     mWrappedNativeProtoMap->Enumerate(WNProtoRemover,
                                       GetRuntime()->GetDetachedWrappedNativeProtoMap());
     mMainThreadWrappedNativeProtoMap->Enumerate(WNProtoRemover,
                                                 GetRuntime()->GetDetachedWrappedNativeProtoMap());
 }