Bug 1703786 - Use nsILoadInfo.sandboxFlags instead r=valentin,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D112154
This commit is contained in:
Hubert Boma Manilla 2021-04-15 11:14:23 +00:00
Родитель 6d7ec21683
Коммит eec8ef34ae
10 изменённых файлов: 4 добавлений и 48 удалений

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

@ -10100,10 +10100,6 @@ nsIPrincipal* nsDocShell::GetInheritedPrincipal(
}
}
if (httpChannelInternal && aBrowsingContext->GetSandboxFlags() != 0) {
httpChannelInternal->SetHasNonEmptySandboxingFlag(true);
}
nsCOMPtr<nsIURI> rpURI;
aLoadInfo->GetResultPrincipalURI(getter_AddRefs(rpURI));
Maybe<nsCOMPtr<nsIURI>> originalResultPrincipalURI;

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

@ -320,7 +320,6 @@ struct HttpChannelOpenArgs
TimeStamp handleFetchEventEnd;
bool forceMainDocumentChannel;
TimeStamp navigationStartTimeStamp;
bool hasNonEmptySandboxingFlag;
};
struct HttpChannelConnectArgs

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

@ -666,11 +666,6 @@ void ClassifierDummyChannel::SetIPv4Disabled() {}
void ClassifierDummyChannel::SetIPv6Disabled() {}
bool ClassifierDummyChannel::GetHasNonEmptySandboxingFlag() { return false; }
void ClassifierDummyChannel::SetHasNonEmptySandboxingFlag(
bool aHasNonEmptySandboxingFlag) {}
NS_IMETHODIMP ClassifierDummyChannel::ComputeCrossOriginOpenerPolicy(
nsILoadInfo::CrossOriginOpenerPolicy aInitiatorPolicy,
nsILoadInfo::CrossOriginOpenerPolicy* aOutPolicy) {

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

@ -2376,7 +2376,7 @@ nsresult HttpBaseChannel::ComputeCrossOriginOpenerPolicyMismatch() {
// 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.
if (resultPolicy != nsILoadInfo::OPENER_POLICY_UNSAFE_NONE &&
GetHasNonEmptySandboxingFlag()) {
mLoadInfo->GetSandboxFlags()) {
LOG((
"HttpBaseChannel::ComputeCrossOriginOpenerPolicyMismatch network error "
"for non empty sandboxing and non null COOP"));

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

@ -328,13 +328,6 @@ class HttpBaseChannel : public nsHashPropertyBag,
NS_IMETHOD HasCrossOriginOpenerPolicyMismatch(bool* aIsMismatch) override;
NS_IMETHOD GetResponseEmbedderPolicy(
nsILoadInfo::CrossOriginEmbedderPolicy* aOutPolicy) override;
virtual bool GetHasNonEmptySandboxingFlag() override {
return LoadHasNonEmptySandboxingFlag();
}
virtual void SetHasNonEmptySandboxingFlag(
bool aHasNonEmptySandboxingFlag) override {
StoreHasNonEmptySandboxingFlag(aHasNonEmptySandboxingFlag);
}
inline void CleanRedirectCacheChainIfNecessary() {
mRedirectedCachekeys = nullptr;
@ -844,9 +837,6 @@ class HttpBaseChannel : public nsHashPropertyBag,
// to upgrade the request to a secure channel.
(uint32_t, UpgradableToSecure, 1),
// True if the docshell's sandboxing flag set is not empty.
(uint32_t, HasNonEmptySandboxingFlag, 1),
// Tainted origin flag of a request, specified by
// WHATWG Fetch Standard 2.2.5.
(uint32_t, TaintedOriginFlag, 1),

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

@ -2278,7 +2278,6 @@ nsresult HttpChannelChild::ContinueAsyncOpen() {
openArgs.forceMainDocumentChannel() = LoadForceMainDocumentChannel();
openArgs.navigationStartTimeStamp() = navigationStartTimeStamp;
openArgs.hasNonEmptySandboxingFlag() = GetHasNonEmptySandboxingFlag();
// This must happen before the constructor message is sent. Otherwise messages
// from the parent could arrive quickly and be delivered to the wrong event

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

@ -140,7 +140,7 @@ bool HttpChannelParent::Init(const HttpChannelCreationArgs& aArgs) {
a.launchServiceWorkerEnd(), a.dispatchFetchEventStart(),
a.dispatchFetchEventEnd(), a.handleFetchEventStart(),
a.handleFetchEventEnd(), a.forceMainDocumentChannel(),
a.navigationStartTimeStamp(), a.hasNonEmptySandboxingFlag());
a.navigationStartTimeStamp());
}
case HttpChannelCreationArgs::THttpChannelConnectArgs: {
const HttpChannelConnectArgs& cArgs = aArgs.get_HttpChannelConnectArgs();
@ -393,8 +393,7 @@ bool HttpChannelParent::DoAsyncOpen(
const TimeStamp& aHandleFetchEventStart,
const TimeStamp& aHandleFetchEventEnd,
const bool& aForceMainDocumentChannel,
const TimeStamp& aNavigationStartTimeStamp,
const bool& aHasNonEmptySandboxingFlag) {
const TimeStamp& aNavigationStartTimeStamp) {
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
if (!uri) {
// URIParams does MOZ_ASSERT if null, but we need to protect opt builds from
@ -477,10 +476,6 @@ bool HttpChannelParent::DoAsyncOpen(
httpChannel->SetIsMainDocumentChannel(true);
}
if (aHasNonEmptySandboxingFlag) {
httpChannel->SetHasNonEmptySandboxingFlag(true);
}
for (uint32_t i = 0; i < requestHeaders.Length(); i++) {
if (requestHeaders[i].mEmpty) {
httpChannel->SetEmptyRequestHeader(requestHeaders[i].mHeader);

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

@ -169,8 +169,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
const TimeStamp& aHandleFetchEventStart,
const TimeStamp& aHandleFetchEventEnd,
const bool& aForceMainDocumentChannel,
const TimeStamp& aNavigationStartTimeStamp,
const bool& hasNonEmptySandboxingFlag);
const TimeStamp& aNavigationStartTimeStamp);
virtual mozilla::ipc::IPCResult RecvSetPriority(
const int16_t& priority) override;

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

@ -428,8 +428,6 @@ interface nsIHttpChannelInternal : nsISupports
[noscript]
nsILoadInfo_CrossOriginEmbedderPolicy getResponseEmbedderPolicy();
[notxpcom, nostdcall] attribute boolean hasNonEmptySandboxingFlag;
[noscript, notxpcom, nostdcall]
void DoDiagnosticAssertWhenOnStopNotCalledOnDestroy();

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

@ -1057,21 +1057,6 @@ void nsViewSourceChannel::SetIPv6Disabled() {
}
}
bool nsViewSourceChannel::GetHasNonEmptySandboxingFlag() {
if (mHttpChannelInternal) {
return mHttpChannelInternal->GetHasNonEmptySandboxingFlag();
}
return false;
}
void nsViewSourceChannel::SetHasNonEmptySandboxingFlag(
bool aHasNonEmptySandboxingFlag) {
if (mHttpChannelInternal) {
mHttpChannelInternal->SetHasNonEmptySandboxingFlag(
aHasNonEmptySandboxingFlag);
}
}
void nsViewSourceChannel::DoDiagnosticAssertWhenOnStopNotCalledOnDestroy() {
if (mHttpChannelInternal) {
mHttpChannelInternal->DoDiagnosticAssertWhenOnStopNotCalledOnDestroy();