зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1462772 P2 Add the registration Id to the ServiceWorkerDescriptor. r=mrbkap
This commit is contained in:
Родитель
083c06c238
Коммит
4866ecedf2
|
@ -15,6 +15,7 @@ namespace dom {
|
|||
struct IPCServiceWorkerDescriptor
|
||||
{
|
||||
uint64_t id;
|
||||
uint64_t registrationId;
|
||||
PrincipalInfo principalInfo;
|
||||
nsCString scope;
|
||||
nsCString scriptURL;
|
||||
|
|
|
@ -16,6 +16,7 @@ using mozilla::ipc::PrincipalInfo;
|
|||
using mozilla::ipc::PrincipalInfoToPrincipal;
|
||||
|
||||
ServiceWorkerDescriptor::ServiceWorkerDescriptor(uint64_t aId,
|
||||
uint64_t aRegistrationId,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptURL,
|
||||
|
@ -26,17 +27,20 @@ ServiceWorkerDescriptor::ServiceWorkerDescriptor(uint64_t aId,
|
|||
PrincipalToPrincipalInfo(aPrincipal, &mData->principalInfo()));
|
||||
|
||||
mData->id() = aId;
|
||||
mData->registrationId() = aRegistrationId;
|
||||
mData->scope() = aScope;
|
||||
mData->scriptURL() = aScriptURL;
|
||||
mData->state() = aState;
|
||||
}
|
||||
|
||||
ServiceWorkerDescriptor::ServiceWorkerDescriptor(uint64_t aId,
|
||||
uint64_t aRegistrationId,
|
||||
const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptURL,
|
||||
ServiceWorkerState aState)
|
||||
: mData(MakeUnique<IPCServiceWorkerDescriptor>(aId, aPrincipalInfo,
|
||||
: mData(MakeUnique<IPCServiceWorkerDescriptor>(aId, aRegistrationId,
|
||||
aPrincipalInfo,
|
||||
nsCString(aScriptURL),
|
||||
nsCString(aScope), aState))
|
||||
{
|
||||
|
@ -92,6 +96,12 @@ ServiceWorkerDescriptor::Id() const
|
|||
return mData->id();
|
||||
}
|
||||
|
||||
uint64_t
|
||||
ServiceWorkerDescriptor::RegistrationId() const
|
||||
{
|
||||
return mData->registrationId();
|
||||
}
|
||||
|
||||
const mozilla::ipc::PrincipalInfo&
|
||||
ServiceWorkerDescriptor::PrincipalInfo() const
|
||||
{
|
||||
|
|
|
@ -36,12 +36,14 @@ class ServiceWorkerDescriptor final
|
|||
|
||||
public:
|
||||
ServiceWorkerDescriptor(uint64_t aId,
|
||||
uint64_t aRegistrationId,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptURL,
|
||||
ServiceWorkerState aState);
|
||||
|
||||
ServiceWorkerDescriptor(uint64_t aId,
|
||||
uint64_t aRegistrationId,
|
||||
const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptURL,
|
||||
|
@ -67,6 +69,9 @@ public:
|
|||
uint64_t
|
||||
Id() const;
|
||||
|
||||
uint64_t
|
||||
RegistrationId() const;
|
||||
|
||||
const mozilla::ipc::PrincipalInfo&
|
||||
PrincipalInfo() const;
|
||||
|
||||
|
|
|
@ -181,11 +181,12 @@ ServiceWorkerInfo::UpdateState(ServiceWorkerState aState)
|
|||
|
||||
ServiceWorkerInfo::ServiceWorkerInfo(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
uint64_t aRegistrationId,
|
||||
const nsACString& aScriptSpec,
|
||||
const nsAString& aCacheName,
|
||||
nsLoadFlags aImportsLoadFlags)
|
||||
: mPrincipal(aPrincipal)
|
||||
, mDescriptor(GetNextID(), aPrincipal, aScope, aScriptSpec,
|
||||
, mDescriptor(GetNextID(), aRegistrationId, aPrincipal, aScope, aScriptSpec,
|
||||
ServiceWorkerState::Parsed)
|
||||
, mCacheName(aCacheName)
|
||||
, mImportsLoadFlags(aImportsLoadFlags)
|
||||
|
|
|
@ -142,6 +142,7 @@ public:
|
|||
|
||||
ServiceWorkerInfo(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
uint64_t aRegistrationId,
|
||||
const nsACString& aScriptSpec,
|
||||
const nsAString& aCacheName,
|
||||
nsLoadFlags aLoadFlags);
|
||||
|
|
|
@ -1583,6 +1583,7 @@ ServiceWorkerManager::LoadRegistration(
|
|||
registration->SetActive(
|
||||
new ServiceWorkerInfo(registration->Principal(),
|
||||
registration->Scope(),
|
||||
registration->Id(),
|
||||
currentWorkerURL,
|
||||
aRegistration.cacheName(),
|
||||
importsLoadFlags));
|
||||
|
|
|
@ -729,6 +729,12 @@ ServiceWorkerRegistrationInfo::Descriptor() const
|
|||
return mDescriptor;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
ServiceWorkerRegistrationInfo::Id() const
|
||||
{
|
||||
return mDescriptor.Id();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ServiceWorkerRegistrationInfo::GetUpdateDelay()
|
||||
{
|
||||
|
|
|
@ -221,6 +221,9 @@ public:
|
|||
const ServiceWorkerRegistrationDescriptor&
|
||||
Descriptor() const;
|
||||
|
||||
uint64_t
|
||||
Id() const;
|
||||
|
||||
uint32_t
|
||||
GetUpdateDelay();
|
||||
|
||||
|
|
|
@ -461,6 +461,7 @@ ServiceWorkerUpdateJob::ComparisonResult(nsresult aStatus,
|
|||
RefPtr<ServiceWorkerInfo> sw =
|
||||
new ServiceWorkerInfo(mRegistration->Principal(),
|
||||
mRegistration->Scope(),
|
||||
mRegistration->Id(),
|
||||
mScriptSpec,
|
||||
aNewCacheName,
|
||||
flags);
|
||||
|
|
Загрузка…
Ссылка в новой задаче