зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 54a1f0cb64d9 (bug 1340163) for crashing e.g. in browser/components/originattributes/test/browser/browser_cacheAPI.js. r=backout
This commit is contained in:
Родитель
079d19514c
Коммит
a472d9b04f
|
@ -135,10 +135,7 @@ ReadSuffixAndSpec(JSStructuredCloneReader* aReader,
|
|||
}
|
||||
|
||||
nsAutoCString suffix;
|
||||
if (!suffix.SetLength(suffixLength, fallible)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
suffix.SetLength(suffixLength);
|
||||
if (!JS_ReadBytes(aReader, suffix.BeginWriting(), suffixLength)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -147,10 +144,7 @@ ReadSuffixAndSpec(JSStructuredCloneReader* aReader,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!aSpec.SetLength(specLength, fallible)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aSpec.SetLength(specLength);
|
||||
if (!JS_ReadBytes(aReader, aSpec.BeginWriting(), specLength)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -201,7 +195,7 @@ ReadPrincipalInfo(JSStructuredCloneReader* aReader,
|
|||
return false;
|
||||
}
|
||||
|
||||
aInfo = ContentPrincipalInfo(attrs, void_t(), spec);
|
||||
aInfo = ContentPrincipalInfo(attrs, spec);
|
||||
} else {
|
||||
MOZ_CRASH("unexpected principal structured clone tag");
|
||||
}
|
||||
|
|
|
@ -1975,15 +1975,15 @@ ReadResponse(mozIStorageConnection* aConn, EntryId aEntryId,
|
|||
|
||||
aSavedResponseOut->mValue.principalInfo() = void_t();
|
||||
if (!serializedInfo.IsEmpty()) {
|
||||
nsAutoCString specNoSuffix;
|
||||
nsAutoCString originNoSuffix;
|
||||
OriginAttributes attrs;
|
||||
if (!attrs.PopulateFromOrigin(serializedInfo, specNoSuffix)) {
|
||||
if (!attrs.PopulateFromOrigin(serializedInfo, originNoSuffix)) {
|
||||
NS_WARNING("Something went wrong parsing a serialized principal!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aSavedResponseOut->mValue.principalInfo() =
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, void_t(), specNoSuffix);
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, originNoSuffix);
|
||||
}
|
||||
|
||||
rv = state->GetBlobAsUTF8String(6, aSavedResponseOut->mValue.channelInfo().securityInfo());
|
||||
|
|
|
@ -354,7 +354,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
GET_LINE(entry->scope());
|
||||
|
||||
entry->principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, void_t(), entry->scope());
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, entry->scope());
|
||||
|
||||
GET_LINE(entry->currentWorkerURL());
|
||||
|
||||
|
@ -395,7 +395,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
GET_LINE(entry->scope());
|
||||
|
||||
entry->principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, void_t(), entry->scope());
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, entry->scope());
|
||||
|
||||
GET_LINE(entry->currentWorkerURL());
|
||||
|
||||
|
@ -428,7 +428,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
GET_LINE(entry->scope());
|
||||
|
||||
entry->principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, void_t(), entry->scope());
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, entry->scope());
|
||||
|
||||
GET_LINE(entry->currentWorkerURL());
|
||||
|
||||
|
@ -458,7 +458,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
GET_LINE(entry->scope());
|
||||
|
||||
entry->principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, void_t(), entry->scope());
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, entry->scope());
|
||||
|
||||
GET_LINE(entry->currentWorkerURL());
|
||||
|
||||
|
@ -488,7 +488,7 @@ ServiceWorkerRegistrar::ReadData()
|
|||
GET_LINE(entry->scope());
|
||||
|
||||
entry->principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, void_t(), entry->scope());
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, entry->scope());
|
||||
|
||||
// scriptSpec is no more used in latest version.
|
||||
GET_LINE(unused);
|
||||
|
|
|
@ -243,8 +243,7 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
|||
nsAutoCString spec;
|
||||
spec.AppendPrintf("spec write %d", i);
|
||||
reg.principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(mozilla::OriginAttributes(i, i % 2),
|
||||
mozilla::void_t(), spec);
|
||||
mozilla::ipc::ContentPrincipalInfo(mozilla::OriginAttributes(i, i % 2), spec);
|
||||
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
}
|
||||
|
@ -598,8 +597,7 @@ TEST(ServiceWorkerRegistrar, TestDedupeWrite)
|
|||
nsAutoCString spec;
|
||||
spec.AppendPrintf("spec write dedupe/%d", i);
|
||||
reg.principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(mozilla::OriginAttributes(0, false),
|
||||
mozilla::void_t(), spec);
|
||||
mozilla::ipc::ContentPrincipalInfo(mozilla::OriginAttributes(0, false), spec);
|
||||
|
||||
swr->TestRegisterServiceWorker(reg);
|
||||
}
|
||||
|
|
|
@ -94,18 +94,6 @@ PrincipalInfoToPrincipal(const PrincipalInfo& aPrincipalInfo,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// When the principal is serialized, the origin is extract from it. This
|
||||
// can fail, and in case, here we will havea Tvoid_t. If we have a string,
|
||||
// it must match with what the_new_principal.getOrigin returns.
|
||||
if (info.originNoSuffix().type() == ContentPrincipalInfoOriginNoSuffix::TnsCString) {
|
||||
nsAutoCString originNoSuffix;
|
||||
rv = principal->GetOrigin(originNoSuffix);
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) ||
|
||||
!info.originNoSuffix().get_nsCString().Equals(originNoSuffix)) {
|
||||
MOZ_CRASH("If the origin was in the contentPrincipalInfo, it must be available when deserialized");
|
||||
}
|
||||
}
|
||||
|
||||
return principal.forget();
|
||||
}
|
||||
|
||||
|
@ -234,18 +222,8 @@ PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
|
|||
return rv;
|
||||
}
|
||||
|
||||
ContentPrincipalInfoOriginNoSuffix infoOriginNoSuffix;
|
||||
|
||||
nsCString originNoSuffix;
|
||||
rv = aPrincipal->GetOriginNoSuffix(originNoSuffix);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
infoOriginNoSuffix = void_t();
|
||||
} else {
|
||||
infoOriginNoSuffix = originNoSuffix;
|
||||
}
|
||||
|
||||
*aPrincipalInfo = ContentPrincipalInfo(aPrincipal->OriginAttributesRef(),
|
||||
infoOriginNoSuffix, spec);
|
||||
spec);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,21 +8,9 @@ using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
|||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
union ContentPrincipalInfoOriginNoSuffix
|
||||
{
|
||||
nsCString;
|
||||
void_t;
|
||||
};
|
||||
|
||||
struct ContentPrincipalInfo
|
||||
{
|
||||
OriginAttributes attrs;
|
||||
|
||||
// nsIPrincipal.originNoSuffix can fail. In case this happens, this value
|
||||
// will be set to void_t. So far, this is used only for dom/media.
|
||||
// It will be removed in bug 1347817.
|
||||
ContentPrincipalInfoOriginNoSuffix originNoSuffix;
|
||||
|
||||
nsCString spec;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче