author | Noemi Erli <nerli@mozilla.com> |
Tue, 08 Oct 2019 22:25:20 +0300 | |
changeset 496806 | b44da78c9070d87870a6fb5ce924b273dcae8369 |
parent 496805 | 258c68e013454a876c4c65a2556a43d4739a26c4 |
child 496807 | 52abae8658fc0611943f3d7fb41a0ae75fcc580b |
push id | 36668 |
push user | aiakab@mozilla.com |
push date | Wed, 09 Oct 2019 04:06:09 +0000 |
treeherder | mozilla-central@26ebfec08834 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1566868, 1528607 |
milestone | 71.0a1 |
backs out | e0427b37129bb0272be31d8d212db607db776f5c |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -7371,36 +7371,29 @@ nsresult nsHttpChannel::ComputeCrossOrig mResponseHead ? mResponseHead : mCachedResponseHead; if (!head) { return NS_ERROR_NOT_AVAILABLE; } RefPtr<mozilla::dom::BrowsingContext> ctx; mLoadInfo->GetBrowsingContext(getter_AddRefs(ctx)); - RefPtr<BrowsingContext> inherit = ctx->GetParent(); - if (!inherit) { - inherit = ctx->GetOpener(); - } - - if (!inherit || !inherit->Top()->Canonical()->GetCurrentWindowGlobal()) { - return NS_ERROR_NOT_AVAILABLE; - } - // Get the policy of the active document, and the policy for the result. nsILoadInfo::CrossOriginOpenerPolicy documentPolicy = ctx->GetOpenerPolicy(); nsILoadInfo::CrossOriginOpenerPolicy resultPolicy = nsILoadInfo::OPENER_POLICY_NULL; Unused << GetCrossOriginOpenerPolicy(documentPolicy, &resultPolicy); + if (!ctx->Canonical()->GetCurrentWindowGlobal()) { + return NS_ERROR_NOT_AVAILABLE; + } + // We use the top window principal as the documentOrigin - nsCOMPtr<nsIPrincipal> documentOrigin = inherit->Top() - ->Canonical() - ->GetCurrentWindowGlobal() - ->DocumentPrincipal(); + nsCOMPtr<nsIPrincipal> documentOrigin = + ctx->Canonical()->GetCurrentWindowGlobal()->DocumentPrincipal(); nsCOMPtr<nsIPrincipal> resultOrigin; nsContentUtils::GetSecurityManager()->GetChannelResultPrincipal( this, getter_AddRefs(resultOrigin)); bool compareResult = CompareCrossOriginOpenerPolicies( documentPolicy, documentOrigin, resultPolicy, resultOrigin);