mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 4ed31c8b45c6 (bug 1041340) for causing multiple timeouts on different platforms in service worker tests on a CLOSED TREE
This commit is contained in:
parent
14df889e86
commit
16a0a6ed9c
@ -1930,6 +1930,10 @@ void
|
|||||||
ServiceWorkerManager::MaybeStartControlling(nsIDocument* aDoc)
|
ServiceWorkerManager::MaybeStartControlling(nsIDocument* aDoc)
|
||||||
{
|
{
|
||||||
AssertIsOnMainThread();
|
AssertIsOnMainThread();
|
||||||
|
if (!Preferences::GetBool("dom.serviceWorkers.enabled")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nsRefPtr<ServiceWorkerRegistrationInfo> registration =
|
nsRefPtr<ServiceWorkerRegistrationInfo> registration =
|
||||||
GetServiceWorkerRegistrationInfo(aDoc);
|
GetServiceWorkerRegistrationInfo(aDoc);
|
||||||
if (registration) {
|
if (registration) {
|
||||||
@ -1941,35 +1945,14 @@ ServiceWorkerManager::MaybeStartControlling(nsIDocument* aDoc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ServiceWorkerActivateAfterUnloadingJob MOZ_FINAL : public ServiceWorkerJob
|
|
||||||
{
|
|
||||||
nsRefPtr<ServiceWorkerRegistrationInfo> mRegistration;
|
|
||||||
public:
|
|
||||||
ServiceWorkerActivateAfterUnloadingJob(ServiceWorkerJobQueue* aQueue,
|
|
||||||
ServiceWorkerRegistrationInfo* aReg)
|
|
||||||
: ServiceWorkerJob(aQueue)
|
|
||||||
, mRegistration(aReg)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void
|
|
||||||
Start()
|
|
||||||
{
|
|
||||||
if (mRegistration->mPendingUninstall) {
|
|
||||||
mRegistration->Clear();
|
|
||||||
nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
|
||||||
swm->RemoveRegistration(mRegistration);
|
|
||||||
} else {
|
|
||||||
mRegistration->TryToActivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
Done(NS_OK);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ServiceWorkerManager::MaybeStopControlling(nsIDocument* aDoc)
|
ServiceWorkerManager::MaybeStopControlling(nsIDocument* aDoc)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aDoc);
|
MOZ_ASSERT(aDoc);
|
||||||
|
if (!Preferences::GetBool("dom.serviceWorkers.enabled")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nsRefPtr<ServiceWorkerRegistrationInfo> registration;
|
nsRefPtr<ServiceWorkerRegistrationInfo> registration;
|
||||||
mControlledDocuments.Remove(aDoc, getter_AddRefs(registration));
|
mControlledDocuments.Remove(aDoc, getter_AddRefs(registration));
|
||||||
// A document which was uncontrolled does not maintain that state itself, so
|
// A document which was uncontrolled does not maintain that state itself, so
|
||||||
@ -1977,14 +1960,6 @@ ServiceWorkerManager::MaybeStopControlling(nsIDocument* aDoc)
|
|||||||
// associated registration. So this check is required.
|
// associated registration. So this check is required.
|
||||||
if (registration) {
|
if (registration) {
|
||||||
registration->StopControllingADocument();
|
registration->StopControllingADocument();
|
||||||
if (!registration->IsControllingDocuments()) {
|
|
||||||
ServiceWorkerJobQueue* queue = GetOrCreateJobQueue(registration->mScope);
|
|
||||||
// The remaining tasks touch registration->mPendingUninstall, so queue
|
|
||||||
// them up in a job.
|
|
||||||
nsRefPtr<ServiceWorkerActivateAfterUnloadingJob> job =
|
|
||||||
new ServiceWorkerActivateAfterUnloadingJob(queue, registration);
|
|
||||||
queue->Append(job);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,13 +290,12 @@ class ServiceWorkerManager MOZ_FINAL
|
|||||||
, public nsIIPCBackgroundChildCreateCallback
|
, public nsIIPCBackgroundChildCreateCallback
|
||||||
{
|
{
|
||||||
friend class ActivationRunnable;
|
friend class ActivationRunnable;
|
||||||
|
friend class ServiceWorkerRegistrationInfo;
|
||||||
|
friend class ServiceWorkerRegisterJob;
|
||||||
friend class GetReadyPromiseRunnable;
|
friend class GetReadyPromiseRunnable;
|
||||||
friend class GetRegistrationsRunnable;
|
friend class GetRegistrationsRunnable;
|
||||||
friend class GetRegistrationRunnable;
|
friend class GetRegistrationRunnable;
|
||||||
friend class QueueFireUpdateFoundRunnable;
|
friend class QueueFireUpdateFoundRunnable;
|
||||||
friend class ServiceWorkerActivateAfterUnloadingJob;
|
|
||||||
friend class ServiceWorkerRegisterJob;
|
|
||||||
friend class ServiceWorkerRegistrationInfo;
|
|
||||||
friend class ServiceWorkerUnregisterJob;
|
friend class ServiceWorkerUnregisterJob;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -350,8 +349,6 @@ public:
|
|||||||
void
|
void
|
||||||
RemoveRegistration(ServiceWorkerRegistrationInfo* aRegistration)
|
RemoveRegistration(ServiceWorkerRegistrationInfo* aRegistration)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aRegistration);
|
|
||||||
MOZ_ASSERT(!aRegistration->IsControllingDocuments());
|
|
||||||
MOZ_ASSERT(mServiceWorkerRegistrationInfos.Contains(aRegistration->mScope));
|
MOZ_ASSERT(mServiceWorkerRegistrationInfos.Contains(aRegistration->mScope));
|
||||||
ServiceWorkerManager::RemoveScope(mOrderedScopes, aRegistration->mScope);
|
ServiceWorkerManager::RemoveScope(mOrderedScopes, aRegistration->mScope);
|
||||||
mServiceWorkerRegistrationInfos.Remove(aRegistration->mScope);
|
mServiceWorkerRegistrationInfos.Remove(aRegistration->mScope);
|
||||||
|
@ -140,7 +140,8 @@
|
|||||||
window.onmessage = null;
|
window.onmessage = null;
|
||||||
// We have to make frame navigate away, otherwise it will call
|
// We have to make frame navigate away, otherwise it will call
|
||||||
// MaybeStopControlling() when this document is unloaded. At that point
|
// MaybeStopControlling() when this document is unloaded. At that point
|
||||||
// the pref has been disabled, so the ServiceWorkerManager is not available.
|
// the pref has been disabled, and so MaybeStopControlling() will just
|
||||||
|
// return since it is currently gated.
|
||||||
frame.setAttribute("src", new URL("about:blank").href);
|
frame.setAttribute("src", new URL("about:blank").href);
|
||||||
resolve();
|
resolve();
|
||||||
} else if (e.data.type == "check") {
|
} else if (e.data.type == "check") {
|
||||||
|
Loading…
Reference in New Issue
Block a user