forked from mirrors/gecko-dev
Bug 1635365: Move field mixed content IsSecure from BrowsingContext to WindowContext. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D74269
This commit is contained in:
parent
62b809186b
commit
1470386f05
7 changed files with 22 additions and 21 deletions
|
|
@ -1921,11 +1921,6 @@ bool BrowsingContext::CanSet(FieldIndex<IDX_AllowPlugins>,
|
|||
return CheckOnlyOwningProcessCanSet(aSource);
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_IsSecure>, const bool& aIsSecure,
|
||||
ContentParent* aSource) {
|
||||
return CheckOnlyOwningProcessCanSet(aSource);
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_WatchedByDevtools>,
|
||||
const bool& aWatchedByDevtools,
|
||||
ContentParent* aSource) {
|
||||
|
|
|
|||
|
|
@ -133,10 +133,7 @@ class WindowProxyHolder;
|
|||
FIELD(WatchedByDevtools, bool) \
|
||||
FIELD(TextZoom, float) \
|
||||
/* See nsIRequest for possible flags. */ \
|
||||
FIELD(DefaultLoadFlags, uint32_t) \
|
||||
/* Mixed-Content: If the corresponding documentURI is https, \
|
||||
* then this flag is true. */ \
|
||||
FIELD(IsSecure, bool)
|
||||
FIELD(DefaultLoadFlags, uint32_t)
|
||||
|
||||
// BrowsingContext, in this context, is the cross process replicated
|
||||
// environment in which information about documents is stored. In
|
||||
|
|
@ -728,8 +725,6 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
|||
ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_AllowPlugins>, const bool& aAllowPlugins,
|
||||
ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_IsSecure>, const bool& aIsSecure,
|
||||
ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_WatchedByDevtools>, const bool& aWatchedByDevtools,
|
||||
ContentParent* aSource);
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,15 @@ bool WindowContext::CheckOnlyOwningProcessCanSet(ContentParent* aSource) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool WindowContext::CanSet(FieldIndex<IDX_IsSecure>, const bool& aIsSecure,
|
||||
ContentParent* aSource) {
|
||||
// reject attempts to set isSecure for mixed content from a content process
|
||||
if (XRE_IsContentProcess() || aSource) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowContext::CanSet(FieldIndex<IDX_AllowMixedContent>,
|
||||
const bool& aAllowMixedContent,
|
||||
ContentParent* aSource) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ class WindowGlobalParent;
|
|||
/* Whether this window's channel has been marked as a third-party \
|
||||
* tracking resource */ \
|
||||
FIELD(IsThirdPartyTrackingResourceWindow, bool) \
|
||||
/* Mixed-Content: If the corresponding documentURI is https, \
|
||||
* then this flag is true. */ \
|
||||
FIELD(IsSecure, bool) \
|
||||
/* Whether the user has overriden the mixed content blocker to allow \
|
||||
* mixed content loads to happen */ \
|
||||
FIELD(AllowMixedContent, bool)
|
||||
|
|
@ -113,6 +116,8 @@ class WindowContext : public nsISupports, public nsWrapperCache {
|
|||
return GetOuterWindowId() == 0 && aValue != 0;
|
||||
}
|
||||
|
||||
bool CanSet(FieldIndex<IDX_IsSecure>, const bool& aIsSecure,
|
||||
ContentParent* aSource);
|
||||
bool CanSet(FieldIndex<IDX_AllowMixedContent>, const bool& aAllowMixedContent,
|
||||
ContentParent* aSource);
|
||||
|
||||
|
|
|
|||
|
|
@ -3607,14 +3607,6 @@ void Document::SetDocumentURI(nsIURI* aURI) {
|
|||
if (inner && inner->GetWindowGlobalChild()) {
|
||||
inner->GetWindowGlobalChild()->SetDocumentURI(mDocumentURI);
|
||||
}
|
||||
|
||||
auto* browsingContext = GetBrowsingContext();
|
||||
if (browsingContext) {
|
||||
nsCOMPtr<nsIURI> innerDocURI = NS_GetInnermostURI(mDocumentURI);
|
||||
if (innerDocURI) {
|
||||
browsingContext->SetIsSecure(innerDocURI->SchemeIs("https"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void GetFormattedTimeString(PRTime aTime,
|
||||
|
|
|
|||
|
|
@ -250,6 +250,11 @@ IPCResult WindowGlobalParent::RecvUpdateDocumentURI(nsIURI* aURI) {
|
|||
// XXX(nika): Assert that the URI change was one which makes sense (either
|
||||
// about:blank -> a real URI, or a legal push/popstate URI change?)
|
||||
mDocumentURI = aURI;
|
||||
// Update Mixed Content fields
|
||||
nsCOMPtr<nsIURI> innerDocURI = NS_GetInnermostURI(mDocumentURI);
|
||||
if (innerDocURI) {
|
||||
WindowContext::SetIsSecure(innerDocURI->SchemeIs("https"));
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -837,7 +837,7 @@ nsresult nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
|
|||
// Determine if the rootDoc is https and if the user decided to allow Mixed
|
||||
// Content
|
||||
WindowContext* topWC = requestingWindow->TopWindowContext();
|
||||
bool rootHasSecureConnection = topWC->GetBrowsingContext()->GetIsSecure();
|
||||
bool rootHasSecureConnection = topWC->GetIsSecure();
|
||||
bool allowMixedContent = topWC->GetAllowMixedContent();
|
||||
|
||||
// When navigating an iframe, the iframe may be https
|
||||
|
|
@ -848,7 +848,7 @@ nsresult nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect,
|
|||
|
||||
RefPtr<WindowContext> curWindow = requestingWindow;
|
||||
while (!httpsParentExists && curWindow) {
|
||||
httpsParentExists = curWindow->GetBrowsingContext()->GetIsSecure();
|
||||
httpsParentExists = curWindow->GetIsSecure();
|
||||
curWindow = curWindow->GetParentWindowContext();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue