Bug 1290944 - Part 3.1: Propogate load flags to ServiceWorkerInfo. r=bkelly

--HG--
extra : rebase_source : 906461c06b5859e3a799f4d0b419bb33d4e076c6
extra : histedit_source : f2cb7a617d5546f624d58795c6ec7b0cc886888d
This commit is contained in:
Ho-Pang Hsu 2017-01-04 17:08:55 +08:00
Родитель 011108b52a
Коммит c97ed915b8
4 изменённых файлов: 19 добавлений и 6 удалений

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

@ -171,11 +171,13 @@ ServiceWorkerInfo::UpdateState(ServiceWorkerState aState)
ServiceWorkerInfo::ServiceWorkerInfo(nsIPrincipal* aPrincipal,
const nsACString& aScope,
const nsACString& aScriptSpec,
const nsAString& aCacheName)
const nsAString& aCacheName,
nsLoadFlags aLoadFlags)
: mPrincipal(aPrincipal)
, mScope(aScope)
, mScriptSpec(aScriptSpec)
, mCacheName(aCacheName)
, mLoadFlags(aLoadFlags)
, mState(ServiceWorkerState::EndGuard_)
, mServiceWorkerID(GetNextID())
, mServiceWorkerPrivate(new ServiceWorkerPrivate(this))

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

@ -30,6 +30,7 @@ private:
const nsCString mScope;
const nsCString mScriptSpec;
const nsString mCacheName;
const nsLoadFlags mLoadFlags;
ServiceWorkerState mState;
PrincipalOriginAttributes mOriginAttributes;
@ -103,7 +104,8 @@ public:
ServiceWorkerInfo(nsIPrincipal* aPrincipal,
const nsACString& aScope,
const nsACString& aScriptSpec,
const nsAString& aCacheName);
const nsAString& aCacheName,
nsLoadFlags aLoadFlags);
ServiceWorkerState
State() const
@ -123,6 +125,12 @@ public:
return mCacheName;
}
nsLoadFlags
GetLoadFlags() const
{
return mLoadFlags;
}
uint64_t
ID() const
{

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

@ -1703,9 +1703,11 @@ ServiceWorkerManager::LoadRegistration(
const nsCString& currentWorkerURL = aRegistration.currentWorkerURL();
if (!currentWorkerURL.IsEmpty()) {
registration->SetActive(
new ServiceWorkerInfo(registration->mPrincipal, registration->mScope,
currentWorkerURL, aRegistration.cacheName()));
new ServiceWorkerInfo(registration->mPrincipal,
registration->mScope,
currentWorkerURL,
aRegistration.cacheName(),
registration->GetLoadFlags()));
registration->GetActive()->SetHandlesFetch(aRegistration.currentWorkerHandlesFetch());
registration->GetActive()->SetActivateStateUncheckedWithoutEvent(ServiceWorkerState::Activated);
}

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

@ -415,7 +415,8 @@ ServiceWorkerUpdateJob::ComparisonResult(nsresult aStatus,
RefPtr<ServiceWorkerInfo> sw =
new ServiceWorkerInfo(mRegistration->mPrincipal,
mRegistration->mScope,
mScriptSpec, aNewCacheName);
mScriptSpec, aNewCacheName,
mRegistration->GetLoadFlags());
mRegistration->SetEvaluating(sw);