зеркало из https://github.com/mozilla/pjs.git
Clear the global objects when unrooting them so that we don't leak via cycles
through the global (which is the parent of the proto for various functions on the one hand and references various prototypes on the other hand). Bug 300023, r=shaver, sr=brendan, a=asa
This commit is contained in:
Родитель
0d6b37ccf6
Коммит
bc80ea6d4f
|
@ -198,8 +198,10 @@ mozJSComponentLoader::mozJSComponentLoader()
|
|||
static PRIntn PR_CALLBACK
|
||||
UnrootGlobals(PLHashEntry *he, PRIntn i, void *arg)
|
||||
{
|
||||
JSRuntime *rt = (JSRuntime *)arg;
|
||||
JS_RemoveRootRT(rt, &he->value);
|
||||
JSContext *cx = (JSContext *)arg;
|
||||
JSObject *global = (JSObject *)he->value;
|
||||
JS_ClearScope(cx, global);
|
||||
JS_RemoveRoot(cx, &he->value);
|
||||
nsCRT::free((char *)he->key);
|
||||
return HT_ENUMERATE_REMOVE;
|
||||
}
|
||||
|
@ -997,7 +999,7 @@ mozJSComponentLoader::UnloadAll(PRInt32 aWhen)
|
|||
PL_HashTableDestroy(mModules);
|
||||
mModules = nsnull;
|
||||
|
||||
PL_HashTableEnumerateEntries(mGlobals, UnrootGlobals, mRuntime);
|
||||
PL_HashTableEnumerateEntries(mGlobals, UnrootGlobals, mContext);
|
||||
PL_HashTableDestroy(mGlobals);
|
||||
mGlobals = nsnull;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче