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. // this can resurrect the ServiceWorkerManager pretty late during shutdown.
static bool firstTime = true; static bool firstTime = true;
if (firstTime) { if (firstTime) {
firstTime = false;
AssertIsOnMainThread(); AssertIsOnMainThread();
gInstance = new ServiceWorkerManager(); gInstance = new ServiceWorkerManager();
gInstance->Init(); gInstance->Init();
ClearOnShutdown(&gInstance); ClearOnShutdown(&gInstance);
firstTime = false;
} }
nsRefPtr<ServiceWorkerManager> copy = gInstance.get(); nsRefPtr<ServiceWorkerManager> copy = gInstance.get();
return copy.forget(); return copy.forget();