mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1646573: Part 1 - Fix GetInProcessParent usage in WindowShouldMatchActiveTab. r=zombie,nika
Differential Revision: https://phabricator.services.mozilla.com/D90334
This commit is contained in:
parent
6b380a56a7
commit
6f26095043
@ -191,6 +191,12 @@ bool WindowContext::CanSet(FieldIndex<IDX_IsSecureContext>,
|
|||||||
return CheckOnlyOwningProcessCanSet(aSource);
|
return CheckOnlyOwningProcessCanSet(aSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WindowContext::CanSet(FieldIndex<IDX_IsOriginalFrameSource>,
|
||||||
|
const bool& aIsOriginalFrameSource,
|
||||||
|
ContentParent* aSource) {
|
||||||
|
return CheckOnlyOwningProcessCanSet(aSource);
|
||||||
|
}
|
||||||
|
|
||||||
bool WindowContext::CanSet(FieldIndex<IDX_DocTreeHadAudibleMedia>,
|
bool WindowContext::CanSet(FieldIndex<IDX_DocTreeHadAudibleMedia>,
|
||||||
const bool& aValue, ContentParent* aSource) {
|
const bool& aValue, ContentParent* aSource) {
|
||||||
return IsTop();
|
return IsTop();
|
||||||
|
@ -49,6 +49,7 @@ class BrowsingContextGroup;
|
|||||||
* tracking resource */ \
|
* tracking resource */ \
|
||||||
FIELD(IsThirdPartyTrackingResourceWindow, bool) \
|
FIELD(IsThirdPartyTrackingResourceWindow, bool) \
|
||||||
FIELD(IsSecureContext, bool) \
|
FIELD(IsSecureContext, bool) \
|
||||||
|
FIELD(IsOriginalFrameSource, bool) \
|
||||||
/* Mixed-Content: If the corresponding documentURI is https, \
|
/* Mixed-Content: If the corresponding documentURI is https, \
|
||||||
* then this flag is true. */ \
|
* then this flag is true. */ \
|
||||||
FIELD(IsSecure, bool) \
|
FIELD(IsSecure, bool) \
|
||||||
@ -215,6 +216,8 @@ class WindowContext : public nsISupports, public nsWrapperCache {
|
|||||||
ContentParent* aSource);
|
ContentParent* aSource);
|
||||||
bool CanSet(FieldIndex<IDX_IsSecureContext>, const bool& aIsSecureContext,
|
bool CanSet(FieldIndex<IDX_IsSecureContext>, const bool& aIsSecureContext,
|
||||||
ContentParent* aSource);
|
ContentParent* aSource);
|
||||||
|
bool CanSet(FieldIndex<IDX_IsOriginalFrameSource>,
|
||||||
|
const bool& aIsOriginalFrameSource, ContentParent* aSource);
|
||||||
bool CanSet(FieldIndex<IDX_DocTreeHadAudibleMedia>, const bool& aValue,
|
bool CanSet(FieldIndex<IDX_DocTreeHadAudibleMedia>, const bool& aValue,
|
||||||
ContentParent* aSource);
|
ContentParent* aSource);
|
||||||
bool CanSet(FieldIndex<IDX_AutoplayPermission>, const uint32_t& aValue,
|
bool CanSet(FieldIndex<IDX_AutoplayPermission>, const uint32_t& aValue,
|
||||||
|
@ -128,6 +128,9 @@ WindowGlobalInit WindowGlobalActor::WindowInitializer(
|
|||||||
|
|
||||||
nsCOMPtr<nsITransportSecurityInfo> securityInfo;
|
nsCOMPtr<nsITransportSecurityInfo> securityInfo;
|
||||||
if (nsCOMPtr<nsIChannel> channel = doc->GetChannel()) {
|
if (nsCOMPtr<nsIChannel> channel = doc->GetChannel()) {
|
||||||
|
nsCOMPtr<nsILoadInfo> loadInfo(channel->LoadInfo());
|
||||||
|
fields.mIsOriginalFrameSource = loadInfo->GetOriginalFrameSrcLoad();
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> securityInfoSupports;
|
nsCOMPtr<nsISupports> securityInfoSupports;
|
||||||
channel->GetSecurityInfo(getter_AddRefs(securityInfoSupports));
|
channel->GetSecurityInfo(getter_AddRefs(securityInfoSupports));
|
||||||
securityInfo = do_QueryInterface(securityInfoSupports);
|
securityInfo = do_QueryInterface(securityInfoSupports);
|
||||||
|
@ -225,6 +225,13 @@ void WindowGlobalChild::OnNewDocument(Document* aDocument) {
|
|||||||
txn.SetEmbedderPolicy(policy.ref());
|
txn.SetEmbedderPolicy(policy.ref());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nsCOMPtr<nsIChannel> channel = aDocument->GetChannel()) {
|
||||||
|
nsCOMPtr<nsILoadInfo> loadInfo(channel->LoadInfo());
|
||||||
|
txn.SetIsOriginalFrameSource(loadInfo->GetOriginalFrameSrcLoad());
|
||||||
|
} else {
|
||||||
|
txn.SetIsOriginalFrameSource(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Init Mixed Content Fields
|
// Init Mixed Content Fields
|
||||||
nsCOMPtr<nsIURI> innerDocURI =
|
nsCOMPtr<nsIURI> innerDocURI =
|
||||||
NS_GetInnermostURI(aDocument->GetDocumentURI());
|
NS_GetInnermostURI(aDocument->GetDocumentURI());
|
||||||
|
@ -801,33 +801,19 @@ bool DocInfo::IsTopLevel() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WindowShouldMatchActiveTab(nsPIDOMWindowOuter* aWin) {
|
bool WindowShouldMatchActiveTab(nsPIDOMWindowOuter* aWin) {
|
||||||
if (aWin->GetBrowsingContext()->IsTopContent()) {
|
for (WindowContext* wc = aWin->GetCurrentInnerWindow()->GetWindowContext();
|
||||||
return true;
|
wc; wc = wc->GetParentWindowContext()) {
|
||||||
}
|
BrowsingContext* bc = wc->GetBrowsingContext();
|
||||||
|
if (bc->IsTopContent()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
nsIDocShell* docshell = aWin->GetDocShell();
|
if (bc->GetCreatedDynamically() || !wc->GetIsOriginalFrameSource()) {
|
||||||
if (!docshell || docshell->GetCreatedDynamically()) {
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
}
|
||||||
|
MOZ_ASSERT_UNREACHABLE("Should reach top content before end of loop");
|
||||||
Document* doc = aWin->GetExtantDoc();
|
return false;
|
||||||
if (!doc) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIChannel* channel = doc->GetChannel();
|
|
||||||
if (!channel) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
|
||||||
if (!loadInfo->GetOriginalFrameSrcLoad()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsPIDOMWindowOuter> parent = aWin->GetInProcessParent();
|
|
||||||
MOZ_ASSERT(parent != nullptr);
|
|
||||||
return WindowShouldMatchActiveTab(parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DocInfo::ShouldMatchActiveTabPermission() const {
|
bool DocInfo::ShouldMatchActiveTabPermission() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user