Backed out changeset 8a194fc3bf96 (bug 1634411) for causing perma bc2 failure in browser/components/originattributes/test/browser/browser_postMessage.js CLOSED TREE

This commit is contained in:
Stefan Hindli 2020-04-30 19:08:34 +03:00
Родитель 3e64cd6ca9
Коммит 9d278a82c2
2 изменённых файлов: 1 добавлений и 30 удалений

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

@ -237,8 +237,6 @@ class BasePrincipal : public nsJSPrincipals {
inline bool FastSubsumesIgnoringFPD(nsIPrincipal* aOther);
inline bool FastSubsumesConsideringDomainIgnoringFPD(nsIPrincipal* aOther);
inline bool EqualsIgnoringFPD(nsIPrincipal* aOther);
// Fast way to check whether we have a system principal.
inline bool IsSystemPrincipal() const;
@ -421,32 +419,6 @@ inline bool BasePrincipal::IsSystemPrincipal() const {
return Kind() == eSystemPrincipal;
}
inline bool BasePrincipal::EqualsIgnoringFPD(nsIPrincipal* aOther) {
MOZ_ASSERT(aOther);
auto other = Cast(aOther);
if (Kind() != other->Kind()) {
// Principals of different kinds can't be equal.
return false;
}
// Two principals are considered to be equal if their origins are the same.
// If the two principals are content principals, their origin attributes
// (aka the origin suffix) must also match.
if (Kind() == eSystemPrincipal) {
return this == other;
}
if (Kind() == eContentPrincipal || Kind() == eNullPrincipal) {
return mOriginNoSuffix == other->mOriginNoSuffix &&
dom::ChromeUtils::IsOriginAttributesEqualIgnoringFPD(
mOriginAttributes, other->mOriginAttributes);
}
MOZ_ASSERT(Kind() == eExpandedPrincipal);
return mOriginNoSuffix == other->mOriginNoSuffix;
}
} // namespace mozilla
inline bool nsIPrincipal::IsSystemPrincipal() const {

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

@ -118,8 +118,7 @@ PostMessageEvent::Run() {
// don't do that in other places it seems better to hold the line for
// now. Long-term, we want HTML5 to address this so that we can
// be compliant while being safer.
if (!BasePrincipal::Cast(targetPrin)
->EqualsIgnoringFPD(mProvidedPrincipal)) {
if (!targetPrin->Equals(mProvidedPrincipal)) {
OriginAttributes sourceAttrs = mProvidedPrincipal->OriginAttributesRef();
OriginAttributes targetAttrs = targetPrin->OriginAttributesRef();