Bug 1433545 P1 Add scriptURL to ServiceWorkerDescriptor. r=asuth

This commit is contained in:
Ben Kelly 2018-01-31 08:29:49 -08:00
Родитель 0d6f124415
Коммит e2e2e36fd3
5 изменённых файлов: 19 добавлений и 5 удалений

Просмотреть файл

@ -17,6 +17,7 @@ struct IPCServiceWorkerDescriptor
uint64_t id; uint64_t id;
PrincipalInfo principalInfo; PrincipalInfo principalInfo;
nsCString scope; nsCString scope;
nsCString scriptURL;
ServiceWorkerState state; ServiceWorkerState state;
}; };

Просмотреть файл

@ -15,6 +15,7 @@ namespace dom {
ServiceWorkerDescriptor::ServiceWorkerDescriptor(uint64_t aId, ServiceWorkerDescriptor::ServiceWorkerDescriptor(uint64_t aId,
nsIPrincipal* aPrincipal, nsIPrincipal* aPrincipal,
const nsACString& aScope, const nsACString& aScope,
const nsACString& aScriptURL,
ServiceWorkerState aState) ServiceWorkerState aState)
: mData(MakeUnique<IPCServiceWorkerDescriptor>()) : mData(MakeUnique<IPCServiceWorkerDescriptor>())
{ {
@ -23,14 +24,17 @@ ServiceWorkerDescriptor::ServiceWorkerDescriptor(uint64_t aId,
mData->id() = aId; mData->id() = aId;
mData->scope() = aScope; mData->scope() = aScope;
mData->scriptURL() = aScriptURL;
mData->state() = aState; mData->state() = aState;
} }
ServiceWorkerDescriptor::ServiceWorkerDescriptor(uint64_t aId, ServiceWorkerDescriptor::ServiceWorkerDescriptor(uint64_t aId,
const mozilla::ipc::PrincipalInfo& aPrincipalInfo, const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
const nsACString& aScope, const nsACString& aScope,
const nsACString& aScriptURL,
ServiceWorkerState aState) ServiceWorkerState aState)
: mData(MakeUnique<IPCServiceWorkerDescriptor>(aId, aPrincipalInfo, : mData(MakeUnique<IPCServiceWorkerDescriptor>(aId, aPrincipalInfo,
nsCString(aScriptURL),
nsCString(aScope), aState)) nsCString(aScope), aState))
{ {
} }
@ -94,6 +98,12 @@ ServiceWorkerDescriptor::Scope() const
return mData->scope(); return mData->scope();
} }
const nsCString&
ServiceWorkerDescriptor::ScriptURL() const
{
return mData->scriptURL();
}
ServiceWorkerState ServiceWorkerState
ServiceWorkerDescriptor::State() const ServiceWorkerDescriptor::State() const
{ {

Просмотреть файл

@ -34,11 +34,13 @@ public:
ServiceWorkerDescriptor(uint64_t aId, ServiceWorkerDescriptor(uint64_t aId,
nsIPrincipal* aPrincipal, nsIPrincipal* aPrincipal,
const nsACString& aScope, const nsACString& aScope,
const nsACString& aScriptURL,
ServiceWorkerState aState); ServiceWorkerState aState);
ServiceWorkerDescriptor(uint64_t aId, ServiceWorkerDescriptor(uint64_t aId,
const mozilla::ipc::PrincipalInfo& aPrincipalInfo, const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
const nsACString& aScope, const nsACString& aScope,
const nsACString& aScriptURL,
ServiceWorkerState aState); ServiceWorkerState aState);
explicit ServiceWorkerDescriptor(const IPCServiceWorkerDescriptor& aDescriptor); explicit ServiceWorkerDescriptor(const IPCServiceWorkerDescriptor& aDescriptor);
@ -67,6 +69,9 @@ public:
const nsCString& const nsCString&
Scope() const; Scope() const;
const nsCString&
ScriptURL() const;
ServiceWorkerState ServiceWorkerState
State() const; State() const;

Просмотреть файл

@ -221,7 +221,8 @@ ServiceWorkerInfo::ServiceWorkerInfo(nsIPrincipal* aPrincipal,
const nsAString& aCacheName, const nsAString& aCacheName,
nsLoadFlags aImportsLoadFlags) nsLoadFlags aImportsLoadFlags)
: mPrincipal(aPrincipal) : mPrincipal(aPrincipal)
, mDescriptor(GetNextID(), aPrincipal, aScope, ServiceWorkerState::Parsed) , mDescriptor(GetNextID(), aPrincipal, aScope, aScriptSpec,
ServiceWorkerState::Parsed)
, mScriptSpec(aScriptSpec) , mScriptSpec(aScriptSpec)
, mCacheName(aCacheName) , mCacheName(aCacheName)
, mImportsLoadFlags(aImportsLoadFlags) , mImportsLoadFlags(aImportsLoadFlags)

Просмотреть файл

@ -1854,10 +1854,7 @@ ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
rv = PrincipalToPrincipalInfo(mInfo->Principal(), &principalInfo); rv = PrincipalToPrincipalInfo(mInfo->Principal(), &principalInfo);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
info.mServiceWorkerDescriptor.emplace(ServiceWorkerDescriptor(mInfo->ID(), info.mServiceWorkerDescriptor.emplace(mInfo->Descriptor());
principalInfo,
mInfo->Scope(),
mInfo->State()));
info.mLoadGroup = aLoadGroup; info.mLoadGroup = aLoadGroup;
info.mLoadFailedAsyncRunnable = aLoadFailedRunnable; info.mLoadFailedAsyncRunnable = aLoadFailedRunnable;