Bug 1315905 - Cleanup Necko http security check, r=valentin

This commit is contained in:
Andrea Marchesini 2016-11-25 10:53:59 +01:00
parent d981a267d6
commit 9218d463aa

View File

@ -159,18 +159,22 @@ NeckoParent::GetValidatedOriginAttributes(const SerializedLoadContext& aSerializ
nsIPrincipal* aRequestingPrincipal,
DocShellOriginAttributes& aAttrs)
{
if (!aSerialized.IsNotNull()) {
if (UsingNeckoIPCSecurity()) {
CrashWithReason("GetValidatedOriginAttributes | SerializedLoadContext from child is null");
return "SerializedLoadContext from child is null";
if (!UsingNeckoIPCSecurity()) {
if (!aSerialized.IsNotNull()) {
// If serialized is null, we cannot validate anything. We have to assume
// that this requests comes from a SystemPrincipal.
aAttrs = DocShellOriginAttributes(NECKO_NO_APP_ID, false);
} else {
aAttrs = aSerialized.mOriginAttributes;
}
// If serialized is null, we cannot validate anything. We have to assume
// that this requests comes from a SystemPrincipal.
aAttrs = DocShellOriginAttributes(NECKO_NO_APP_ID, false);
return nullptr;
}
if (!aSerialized.IsNotNull()) {
CrashWithReason("GetValidatedOriginAttributes | SerializedLoadContext from child is null");
return "SerializedLoadContext from child is null";
}
nsTArray<TabContext> contextArray =
static_cast<ContentParent*>(aContent)->GetManagedTabContext();
@ -213,12 +217,6 @@ NeckoParent::GetValidatedOriginAttributes(const SerializedLoadContext& aSerializ
}
}
if (!UsingNeckoIPCSecurity()) {
// We are running some tests
aAttrs = aSerialized.mOriginAttributes;
return nullptr;
}
nsAutoCString errorString;
errorString.Append("GetValidatedOriginAttributes | App does not have permission -");
errorString.Append(debugString);