зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1454646 P2 Implement ServiceWorkerContainer::GetReady() via the Inner class. r=baku
This commit is contained in:
Родитель
a7ef225557
Коммит
13c73ec777
|
@ -289,12 +289,6 @@ ServiceWorkerContainer::GetReady(ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
if (!swm) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
mReadyPromise = Promise::Create(GetParentObject(), aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
|
@ -303,7 +297,7 @@ ServiceWorkerContainer::GetReady(ErrorResult& aRv)
|
|||
RefPtr<ServiceWorkerContainer> self = this;
|
||||
RefPtr<Promise> outer = mReadyPromise;
|
||||
|
||||
swm->WhenReady(clientInfo.ref())->Then(
|
||||
mInner->GetReady(clientInfo.ref())->Then(
|
||||
global->EventTargetFor(TaskCategory::Other), __func__,
|
||||
[self, outer] (const ServiceWorkerRegistrationDescriptor& aDescriptor) {
|
||||
self->mReadyPromiseHolder.Complete();
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
GetRegistrations() = 0;
|
||||
|
||||
virtual RefPtr<ServiceWorkerRegistrationPromise>
|
||||
GetReady() = 0;
|
||||
GetReady(const ClientInfo& aClientInfo) const = 0;
|
||||
|
||||
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
||||
};
|
||||
|
|
|
@ -32,10 +32,15 @@ ServiceWorkerContainerImpl::GetRegistrations()
|
|||
}
|
||||
|
||||
RefPtr<ServiceWorkerRegistrationPromise>
|
||||
ServiceWorkerContainerImpl::GetReady()
|
||||
ServiceWorkerContainerImpl::GetReady(const ClientInfo& aClientInfo) const
|
||||
{
|
||||
// TODO
|
||||
return nullptr;
|
||||
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
if (NS_WARN_IF(!swm)) {
|
||||
return ServiceWorkerRegistrationPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
|
||||
__func__);
|
||||
}
|
||||
|
||||
return swm->WhenReady(aClientInfo);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -18,6 +18,8 @@ class ServiceWorkerContainerImpl final : public ServiceWorkerContainer::Inner
|
|||
~ServiceWorkerContainerImpl() = default;
|
||||
|
||||
public:
|
||||
ServiceWorkerContainerImpl() = default;
|
||||
|
||||
RefPtr<ServiceWorkerRegistrationPromise>
|
||||
Register(const nsAString& aScriptURL,
|
||||
const RegistrationOptions& aOptions) override;
|
||||
|
@ -29,7 +31,7 @@ public:
|
|||
GetRegistrations() override;
|
||||
|
||||
RefPtr<ServiceWorkerRegistrationPromise>
|
||||
GetReady() override;
|
||||
GetReady(const ClientInfo& aClientInfo) const override;
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerContainerImpl, override)
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче