зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1462772 P1 Add a fallible nsIGlobalObject::GetServiceWorkerRegistration() method. r=mrbkap
This commit is contained in:
Родитель
1dad6a26ea
Коммит
083c06c238
|
@ -6411,8 +6411,8 @@ nsGlobalWindowInner::GetOrCreateServiceWorker(const ServiceWorkerDescriptor& aDe
|
|||
return ref.forget();
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerRegistration>
|
||||
nsGlobalWindowInner::GetOrCreateServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor)
|
||||
RefPtr<mozilla::dom::ServiceWorkerRegistration>
|
||||
nsGlobalWindowInner::GetServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor) const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
RefPtr<ServiceWorkerRegistration> ref;
|
||||
|
@ -6425,11 +6425,17 @@ nsGlobalWindowInner::GetOrCreateServiceWorkerRegistration(const ServiceWorkerReg
|
|||
ref = swr.forget();
|
||||
*aDoneOut = true;
|
||||
});
|
||||
return ref.forget();
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerRegistration>
|
||||
nsGlobalWindowInner::GetOrCreateServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
RefPtr<ServiceWorkerRegistration> ref = GetServiceWorkerRegistration(aDescriptor);
|
||||
if (!ref) {
|
||||
ref = ServiceWorkerRegistration::CreateForMainThread(this, aDescriptor);
|
||||
}
|
||||
|
||||
return ref.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -360,6 +360,9 @@ public:
|
|||
virtual RefPtr<mozilla::dom::ServiceWorker>
|
||||
GetOrCreateServiceWorker(const mozilla::dom::ServiceWorkerDescriptor& aDescriptor) override;
|
||||
|
||||
RefPtr<mozilla::dom::ServiceWorkerRegistration>
|
||||
GetServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor) const override;
|
||||
|
||||
RefPtr<mozilla::dom::ServiceWorkerRegistration>
|
||||
GetOrCreateServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor) override;
|
||||
|
||||
|
|
|
@ -207,6 +207,13 @@ nsIGlobalObject::GetOrCreateServiceWorker(const ServiceWorkerDescriptor& aDescri
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerRegistration>
|
||||
nsIGlobalObject::GetServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor) const
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "this global should not have any service workers");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerRegistration>
|
||||
nsIGlobalObject::GetOrCreateServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor)
|
||||
{
|
||||
|
|
|
@ -120,6 +120,11 @@ public:
|
|||
virtual RefPtr<mozilla::dom::ServiceWorker>
|
||||
GetOrCreateServiceWorker(const mozilla::dom::ServiceWorkerDescriptor& aDescriptor);
|
||||
|
||||
// Get the DOM object for the given descriptor or return nullptr if it does
|
||||
// not exist.
|
||||
virtual RefPtr<mozilla::dom::ServiceWorkerRegistration>
|
||||
GetServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor) const;
|
||||
|
||||
// Get the DOM object for the given descriptor or attempt to create one.
|
||||
// Creation can still fail and return nullptr during shutdown, etc.
|
||||
virtual RefPtr<mozilla::dom::ServiceWorkerRegistration>
|
||||
|
|
|
@ -557,8 +557,8 @@ WorkerGlobalScope::GetController() const
|
|||
return mWorkerPrivate->GetController();
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerRegistration>
|
||||
WorkerGlobalScope::GetOrCreateServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor)
|
||||
RefPtr<mozilla::dom::ServiceWorkerRegistration>
|
||||
WorkerGlobalScope::GetServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor) const
|
||||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
RefPtr<ServiceWorkerRegistration> ref;
|
||||
|
@ -571,12 +571,18 @@ WorkerGlobalScope::GetOrCreateServiceWorkerRegistration(const ServiceWorkerRegis
|
|||
ref = swr.forget();
|
||||
*aDoneOut = true;
|
||||
});
|
||||
return ref.forget();
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerRegistration>
|
||||
WorkerGlobalScope::GetOrCreateServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor)
|
||||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
RefPtr<ServiceWorkerRegistration> ref = GetServiceWorkerRegistration(aDescriptor);
|
||||
if (!ref) {
|
||||
ref = ServiceWorkerRegistration::CreateForWorker(mWorkerPrivate, this,
|
||||
aDescriptor);
|
||||
}
|
||||
|
||||
return ref.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -239,6 +239,9 @@ public:
|
|||
Maybe<ServiceWorkerDescriptor>
|
||||
GetController() const override;
|
||||
|
||||
RefPtr<mozilla::dom::ServiceWorkerRegistration>
|
||||
GetServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor) const override;
|
||||
|
||||
RefPtr<mozilla::dom::ServiceWorkerRegistration>
|
||||
GetOrCreateServiceWorkerRegistration(const ServiceWorkerRegistrationDescriptor& aDescriptor) override;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче