Bug 1171486 - Part 2: Make it OK to call ServiceWorkerManager::GetInstance() during its Init() function; r=baku

This commit is contained in:
Ehsan Akhgari 2015-06-02 18:01:26 -04:00
parent e03391c07e
commit a402da64d1

View File

@ -2295,12 +2295,13 @@ ServiceWorkerManager::GetInstance()
// this can resurrect the ServiceWorkerManager pretty late during shutdown.
static bool firstTime = true;
if (firstTime) {
firstTime = false;
AssertIsOnMainThread();
gInstance = new ServiceWorkerManager();
gInstance->Init();
ClearOnShutdown(&gInstance);
firstTime = false;
}
nsRefPtr<ServiceWorkerManager> copy = gInstance.get();
return copy.forget();