Bug 1345961 - Fixing an assertion about OriginAttribute comparison in PostMessage, r=tjr

The OriginAttributes of the 2 windows must match but ignoring the
FirstPartDomain isolation.
This commit is contained in:
Andrea Marchesini 2017-05-04 15:42:42 +02:00
Родитель 7e59b2c7b6
Коммит 17b0547c06
1 изменённых файлов: 5 добавлений и 6 удалений

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

@ -106,18 +106,17 @@ PostMessageEvent::Run()
// now. Long-term, we want HTML5 to address this so that we can
// be compliant while being safer.
if (!targetPrin->Equals(mProvidedPrincipal)) {
MOZ_DIAGNOSTIC_ASSERT(ChromeUtils::IsOriginAttributesEqualIgnoringFPD(mProvidedPrincipal->OriginAttributesRef(),
targetPrin->OriginAttributesRef()),
"Unexpected postMessage call to a window with mismatched "
"origin attributes");
nsAutoString providedOrigin, targetOrigin;
nsresult rv = nsContentUtils::GetUTFOrigin(targetPrin, targetOrigin);
NS_ENSURE_SUCCESS(rv, rv);
rv = nsContentUtils::GetUTFOrigin(mProvidedPrincipal, providedOrigin);
NS_ENSURE_SUCCESS(rv, rv);
MOZ_DIAGNOSTIC_ASSERT(providedOrigin != targetOrigin ||
(mProvidedPrincipal->OriginAttributesRef() ==
targetPrin->OriginAttributesRef()),
"Unexpected postMessage call to a window with mismatched "
"origin attributes");
const char16_t* params[] = { providedOrigin.get(), targetOrigin.get() };
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,