Bug 1600326 - P1 avoid wrongly COOP error for subframe, r=ttung

Differential Revision: https://phabricator.services.mozilla.com/D57578

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Junior Hsu 2019-12-18 20:03:00 +00:00
parent 88ce749554
commit a0e824e158
2 changed files with 5 additions and 5 deletions

View File

@ -305,6 +305,7 @@ nsHttpChannel::nsHttpChannel()
mOfflineCacheLastModifiedTime(0),
mSuspendTotalTime(0),
mRedirectType(0),
mComputedCrossOriginOpenerPolicy(nsILoadInfo::OPENER_POLICY_NULL),
mCacheOpenWithPriority(false),
mCacheQueueSizeWhenOpen(0),
mCachedContentIsValid(false),
@ -7344,10 +7345,10 @@ nsHttpChannel::GetCrossOriginOpenerPolicy(
// If this method is called before OnStartRequest (ie. before we call
// ComputeCrossOriginOpenerPolicy) or if we were unable to compute the
// policy we'll throw an error.
if (!mComputedCrossOriginOpenerPolicy.isSome()) {
if (!mOnStartRequestCalled) {
return NS_ERROR_NOT_AVAILABLE;
}
*aPolicy = mComputedCrossOriginOpenerPolicy.value();
*aPolicy = mComputedCrossOriginOpenerPolicy;
return NS_OK;
}
@ -7411,7 +7412,6 @@ nsresult nsHttpChannel::ComputeCrossOriginOpenerPolicyMismatch() {
if (!head) {
// Not having a response head is not a hard failure at the point where
// this method is called.
mComputedCrossOriginOpenerPolicy = Some(nsILoadInfo::OPENER_POLICY_NULL);
return NS_OK;
}
@ -7428,7 +7428,7 @@ nsresult nsHttpChannel::ComputeCrossOriginOpenerPolicyMismatch() {
nsILoadInfo::CrossOriginOpenerPolicy resultPolicy =
nsILoadInfo::OPENER_POLICY_NULL;
Unused << ComputeCrossOriginOpenerPolicy(documentPolicy, &resultPolicy);
mComputedCrossOriginOpenerPolicy = Some(resultPolicy);
mComputedCrossOriginOpenerPolicy = resultPolicy;
// If bc's popup sandboxing flag set is not empty and potentialCOOP is
// non-null, then navigate bc to a network error and abort these steps.

View File

@ -651,7 +651,7 @@ class nsHttpChannel final : public HttpBaseChannel,
// Gets computed during ComputeCrossOriginOpenerPolicyMismatch so we have
// the channel's policy even if we don't know policy initiator.
Maybe<nsILoadInfo::CrossOriginOpenerPolicy> mComputedCrossOriginOpenerPolicy;
nsILoadInfo::CrossOriginOpenerPolicy mComputedCrossOriginOpenerPolicy;
bool mCacheOpenWithPriority;
uint32_t mCacheQueueSizeWhenOpen;