Backed out changeset b7653e3d5f91 (bug 1174381) for widespread assertion failures.

This commit is contained in:
Ryan VanderMeulen 2015-06-21 07:47:02 -04:00
parent be6f774c61
commit 2904fdbbc7
2 changed files with 16 additions and 38 deletions

View File

@ -379,7 +379,6 @@ NS_INTERFACE_MAP_END
ServiceWorkerManager::ServiceWorkerManager()
: mActor(nullptr)
, mShuttingDown(false)
{
// Register this component to PBackground.
MOZ_ALWAYS_TRUE(BackgroundChild::GetOrCreateForCurrentThread(this));
@ -389,7 +388,14 @@ ServiceWorkerManager::~ServiceWorkerManager()
{
// The map will assert if it is not empty when destroyed.
mRegistrationInfos.Clear();
MOZ_ASSERT(!mActor);
if (mActor) {
mActor->ManagerShuttingDown();
nsRefPtr<TeardownRunnable> runnable = new TeardownRunnable(mActor);
nsresult rv = NS_DispatchToMainThread(runnable);
unused << NS_WARN_IF(NS_FAILED(rv));
}
}
void
@ -1547,11 +1553,9 @@ ServiceWorkerManager::AppendPendingOperation(ServiceWorkerJobQueue* aQueue,
MOZ_ASSERT(aQueue);
MOZ_ASSERT(aJob);
if (!mShuttingDown) {
PendingOperation* opt = mPendingOperations.AppendElement();
opt->mQueue = aQueue;
opt->mJob = aJob;
}
PendingOperation* opt = mPendingOperations.AppendElement();
opt->mQueue = aQueue;
opt->mJob = aJob;
}
void
@ -1560,10 +1564,8 @@ ServiceWorkerManager::AppendPendingOperation(nsIRunnable* aRunnable)
MOZ_ASSERT(!mActor);
MOZ_ASSERT(aRunnable);
if (!mShuttingDown) {
PendingOperation* opt = mPendingOperations.AppendElement();
opt->mRunnable = aRunnable;
}
PendingOperation* opt = mPendingOperations.AppendElement();
opt->mRunnable = aRunnable;
}
/*
@ -2381,10 +2383,8 @@ private:
nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
// We could be shutting down.
if (swm->mActor) {
swm->mActor->SendUnregister(principalInfo, NS_ConvertUTF8toUTF16(mScope));
}
MOZ_ASSERT(swm->mActor);
swm->mActor->SendUnregister(principalInfo, NS_ConvertUTF8toUTF16(mScope));
nsAutoCString scopeKey;
nsresult rv = swm->PrincipalToScopeKey(mPrincipal, scopeKey);
@ -2735,15 +2735,10 @@ ServiceWorkerManager::StoreRegistration(
nsIPrincipal* aPrincipal,
ServiceWorkerRegistrationInfo* aRegistration)
{
MOZ_ASSERT(mActor);
MOZ_ASSERT(aPrincipal);
MOZ_ASSERT(aRegistration);
if (mShuttingDown) {
return;
}
MOZ_ASSERT(mActor);
ServiceWorkerRegistrationData data;
nsresult rv = PopulateRegistrationData(aPrincipal, aRegistration, data);
if (NS_WARN_IF(NS_FAILED(rv))) {
@ -4069,10 +4064,6 @@ ServiceWorkerManager::RemoveRegistrationInternal(ServiceWorkerRegistrationInfo*
MOZ_ASSERT(aRegistration);
MOZ_ASSERT(!aRegistration->IsControllingDocuments());
if (mShuttingDown) {
return;
}
// All callers should be either from a job in which case the actor is
// available, or from MaybeStopControlling(), in which case, this will only be
// called if a valid registration is found. If a valid registration exists,
@ -4551,8 +4542,6 @@ ServiceWorkerManager::Observe(nsISupports* aSubject,
RemoveAllRegistrations(principal);
} else if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
mShuttingDown = true;
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
@ -4560,15 +4549,6 @@ ServiceWorkerManager::Observe(nsISupports* aSubject,
obs->RemoveObserver(this, PURGE_DOMAIN_DATA);
obs->RemoveObserver(this, WEBAPPS_CLEAR_DATA);
}
if (mActor) {
mActor->ManagerShuttingDown();
nsRefPtr<TeardownRunnable> runnable = new TeardownRunnable(mActor);
nsresult rv = NS_DispatchToMainThread(runnable);
unused << NS_WARN_IF(NS_FAILED(rv));
mActor = nullptr;
}
} else {
MOZ_CRASH("Received message we aren't supposed to be registered for!");
}

View File

@ -552,8 +552,6 @@ private:
struct PendingOperation;
nsTArray<PendingOperation> mPendingOperations;
bool mShuttingDown;
};
} // namespace workers