Bug 1678255 - avoid crashing if trying to initialize a fission frameloader with a nullprincipal, r=ckerschb,nika

Differential Revision: https://phabricator.services.mozilla.com/D104865
This commit is contained in:
Gijs Kruitbosch 2021-02-22 19:00:10 +00:00
Родитель 8002a3c48c
Коммит eff2a84fae
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -901,7 +901,10 @@ static already_AddRefed<nsIPrincipal> CreateRemoteTypeIsolationPrincipal(
nsAutoCString origin(
Substring(aRemoteType, offset, aRemoteType.Length() - offset));
return BasePrincipal::CreateContentPrincipal(origin);
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
nsCOMPtr<nsIPrincipal> principal;
ssm->CreateContentPrincipalFromOrigin(origin, getter_AddRefs(principal));
return principal.forget();
}
/*static*/
@ -1429,7 +1432,8 @@ bool ContentParent::ValidatePrincipal(
return true;
}
if (RemoteTypePrefix(mRemoteType) != FISSION_WEB_REMOTE_TYPE) {
if (!mRemoteTypeIsolationPrincipal ||
RemoteTypePrefix(mRemoteType) != FISSION_WEB_REMOTE_TYPE) {
return true;
}