Bug 797940: Don't use a static nsRefPtr for sScriptCacheCleaner. r=smaug

This commit is contained in:
Kyle Huey 2012-10-05 12:10:30 -07:00
parent 3b1062dc73
commit 17621cc7a7
2 changed files with 7 additions and 4 deletions

View File

@ -769,7 +769,7 @@ ContentScriptErrorReporter(JSContext* aCx,
nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>*
nsFrameScriptExecutor::sCachedScripts = nullptr;
nsRefPtr<nsScriptCacheCleaner> nsFrameScriptExecutor::sScriptCacheCleaner;
nsScriptCacheCleaner* nsFrameScriptExecutor::sScriptCacheCleaner = nullptr;
void
nsFrameScriptExecutor::DidCreateCx()
@ -780,7 +780,9 @@ nsFrameScriptExecutor::DidCreateCx()
new nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>;
sCachedScripts->Init();
sScriptCacheCleaner = new nsScriptCacheCleaner();
nsRefPtr<nsScriptCacheCleaner> scriptCacheCleaner =
new nsScriptCacheCleaner();
scriptCacheCleaner.forget(&sScriptCacheCleaner);
}
}
@ -835,7 +837,8 @@ nsFrameScriptExecutor::Shutdown()
delete sCachedScripts;
sCachedScripts = nullptr;
sScriptCacheCleaner = nullptr;
nsRefPtr<nsScriptCacheCleaner> scriptCacheCleaner;
scriptCacheCleaner.swap(sScriptCacheCleaner);
}
}

View File

@ -271,7 +271,7 @@ protected:
bool mDelayedCxDestroy;
nsCOMPtr<nsIPrincipal> mPrincipal;
static nsDataHashtable<nsStringHashKey, nsFrameJSScriptExecutorHolder*>* sCachedScripts;
static nsRefPtr<nsScriptCacheCleaner> sScriptCacheCleaner;
static nsScriptCacheCleaner* sScriptCacheCleaner;
};
class nsFrameScriptCx