зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1614462: Part 3a - Remove support for <iframe mozbrowser> in content processes. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D70748
This commit is contained in:
Родитель
a9d8069037
Коммит
f8eabd5b2a
|
@ -236,25 +236,30 @@ static void GetFrameName(Element* aOwnerContent, nsAString& aFrameName) {
|
||||||
// manner, they are no longer handled by typeContent and typeChrome. Instead,
|
// manner, they are no longer handled by typeContent and typeChrome. Instead,
|
||||||
// the actual BrowsingContext tree is broken at these edges.
|
// the actual BrowsingContext tree is broken at these edges.
|
||||||
static bool IsTopContent(BrowsingContext* aParent, Element* aOwner) {
|
static bool IsTopContent(BrowsingContext* aParent, Element* aOwner) {
|
||||||
|
if (XRE_IsContentProcess()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have a (deprecated) mozbrowser element, we want to start a new
|
||||||
|
// BrowsingContext tree regardless of whether the parent is chrome or content.
|
||||||
nsCOMPtr<nsIMozBrowserFrame> mozbrowser = aOwner->GetAsMozBrowserFrame();
|
nsCOMPtr<nsIMozBrowserFrame> mozbrowser = aOwner->GetAsMozBrowserFrame();
|
||||||
|
if (mozbrowser && mozbrowser->GetReallyIsBrowser()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (aParent->IsContent()) {
|
if (aParent->IsContent()) {
|
||||||
// If we're already in content, we may still want to create a new
|
// If we're already in content, we may still want to create a new
|
||||||
// BrowsingContext tree if our element is either:
|
// BrowsingContext tree if our element is a xul browser element with a
|
||||||
// a) a real <iframe mozbrowser> frame, or
|
// `remote="true"` marker.
|
||||||
// b) a xul browser element with a `remote="true"` marker.
|
return aOwner->IsXULElement() &&
|
||||||
return (mozbrowser && mozbrowser->GetReallyIsBrowser()) ||
|
aOwner->AttrValueIs(kNameSpaceID_None, nsGkAtoms::remote,
|
||||||
(aOwner->IsXULElement() &&
|
nsGkAtoms::_true, eCaseMatters);
|
||||||
aOwner->AttrValueIs(kNameSpaceID_None, nsGkAtoms::remote,
|
|
||||||
nsGkAtoms::_true, eCaseMatters));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're in a chrome context, we want to start a new tree if:
|
// If we're in a chrome context, we want to start a new tree if we are an
|
||||||
// a) we have any mozbrowser frame (even if disabled), or
|
// element with a `type="content"` marker.
|
||||||
// b) we are an element with a `type="content"` marker.
|
return aOwner->AttrValueIs(kNameSpaceID_None, TypeAttrName(aOwner),
|
||||||
return (mozbrowser && mozbrowser->GetMozbrowser()) ||
|
nsGkAtoms::content, eIgnoreCase);
|
||||||
(aOwner->AttrValueIs(kNameSpaceID_None, TypeAttrName(aOwner),
|
|
||||||
nsGkAtoms::content, eIgnoreCase));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static already_AddRefed<BrowsingContext> CreateBrowsingContext(
|
static already_AddRefed<BrowsingContext> CreateBrowsingContext(
|
||||||
|
@ -303,19 +308,8 @@ static already_AddRefed<BrowsingContext> CreateBrowsingContext(
|
||||||
// for the BrowsingContext, and cause no end of trouble.
|
// for the BrowsingContext, and cause no end of trouble.
|
||||||
if (IsTopContent(parentContext, aOwner)) {
|
if (IsTopContent(parentContext, aOwner)) {
|
||||||
// Create toplevel content without a parent & as Type::Content.
|
// Create toplevel content without a parent & as Type::Content.
|
||||||
RefPtr<BrowsingContext> bc = BrowsingContext::CreateDetached(
|
return BrowsingContext::CreateDetached(nullptr, opener, frameName,
|
||||||
nullptr, opener, frameName, BrowsingContext::Type::Content);
|
BrowsingContext::Type::Content);
|
||||||
|
|
||||||
// If this is a mozbrowser frame, pretend it's windowless so that it gets
|
|
||||||
// ownership of its BrowsingContext even though it's a top-level content
|
|
||||||
// frame. This is horrible, but will fortunately go away soon.
|
|
||||||
if (nsCOMPtr<nsIMozBrowserFrame> mozbrowser =
|
|
||||||
aOwner->GetAsMozBrowserFrame()) {
|
|
||||||
if (mozbrowser->GetReallyIsBrowser()) {
|
|
||||||
bc->SetWindowless();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bc.forget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(!aOpenWindowInfo,
|
MOZ_ASSERT(!aOpenWindowInfo,
|
||||||
|
|
|
@ -255,17 +255,6 @@ ScrollbarPreference nsGenericHTMLFrameElement::MapScrollingAttribute(
|
||||||
return ScrollbarPreference::Auto;
|
return ScrollbarPreference::Auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool PrincipalAllowsBrowserFrame(nsIPrincipal* aPrincipal) {
|
|
||||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
|
||||||
mozilla::services::GetPermissionManager();
|
|
||||||
NS_ENSURE_TRUE(permMgr, false);
|
|
||||||
uint32_t permission = nsIPermissionManager::DENY_ACTION;
|
|
||||||
nsresult rv = permMgr->TestPermissionFromPrincipal(
|
|
||||||
aPrincipal, NS_LITERAL_CSTRING("browser"), &permission);
|
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
|
||||||
return permission == nsIPermissionManager::ALLOW_ACTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* virtual */
|
/* virtual */
|
||||||
nsresult nsGenericHTMLFrameElement::AfterSetAttr(
|
nsresult nsGenericHTMLFrameElement::AfterSetAttr(
|
||||||
int32_t aNameSpaceID, nsAtom* aName, const nsAttrValue* aValue,
|
int32_t aNameSpaceID, nsAtom* aName, const nsAttrValue* aValue,
|
||||||
|
@ -296,9 +285,9 @@ nsresult nsGenericHTMLFrameElement::AfterSetAttr(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (aName == nsGkAtoms::mozbrowser) {
|
} else if (aName == nsGkAtoms::mozbrowser) {
|
||||||
mReallyIsBrowser = !!aValue &&
|
mReallyIsBrowser =
|
||||||
StaticPrefs::dom_mozBrowserFramesEnabled() &&
|
!!aValue && StaticPrefs::dom_mozBrowserFramesEnabled() &&
|
||||||
PrincipalAllowsBrowserFrame(NodePrincipal());
|
XRE_IsParentProcess() && NodePrincipal()->IsSystemPrincipal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче