Bug 1428447 Set a loading principal on ServiceWorker WorkerPrivate objects. r=asuth

This commit is contained in:
Ben Kelly 2018-01-05 19:50:09 -05:00
Родитель 6c6df154cd
Коммит 64ef60ebaa
2 изменённых файлов: 2 добавлений и 2 удалений

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

@ -1883,6 +1883,7 @@ ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
if (NS_WARN_IF(!info.mPrincipal)) {
return NS_ERROR_FAILURE;
}
info.mLoadingPrincipal = info.mPrincipal;
nsContentUtils::StorageAccess access =
nsContentUtils::StorageAllowedForPrincipal(info.mPrincipal);

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

@ -5040,8 +5040,7 @@ WorkerPrivate::OverrideLoadInfoLoadGroup(WorkerLoadInfo& aLoadInfo,
nsIPrincipal* aPrincipal)
{
MOZ_ASSERT(!aLoadInfo.mInterfaceRequestor);
MOZ_ASSERT(aLoadInfo.mPrincipal == aPrincipal /* service workers */ ||
aLoadInfo.mLoadingPrincipal == aPrincipal /* any other worker type */);
MOZ_ASSERT(aLoadInfo.mLoadingPrincipal == aPrincipal);
aLoadInfo.mInterfaceRequestor =
new WorkerLoadInfo::InterfaceRequestor(aPrincipal, aLoadInfo.mLoadGroup);