зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1770944 - Remove `nsIMozBrowserFrame`. r=smaug
Depends on D155254 Differential Revision: https://phabricator.services.mozilla.com/D170397
This commit is contained in:
Родитель
0b0569356c
Коммит
e6a0102a3b
|
@ -90,7 +90,6 @@ class nsIDOMXULSelectControlElement;
|
||||||
class nsIDOMXULSelectControlItemElement;
|
class nsIDOMXULSelectControlItemElement;
|
||||||
class nsIFrame;
|
class nsIFrame;
|
||||||
class nsIHTMLCollection;
|
class nsIHTMLCollection;
|
||||||
class nsIMozBrowserFrame;
|
|
||||||
class nsIPrincipal;
|
class nsIPrincipal;
|
||||||
class nsIScreen;
|
class nsIScreen;
|
||||||
class nsIScrollableFrame;
|
class nsIScrollableFrame;
|
||||||
|
@ -458,16 +457,6 @@ class Element : public FragmentOrElement {
|
||||||
*/
|
*/
|
||||||
virtual bool IsInteractiveHTMLContent() const;
|
virtual bool IsInteractiveHTMLContent() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns |this| as an nsIMozBrowserFrame* if the element is a frame or
|
|
||||||
* iframe element.
|
|
||||||
*
|
|
||||||
* We have this method, rather than using QI, so that we can use it during
|
|
||||||
* the servo traversal, where we can't QI DOM nodes because of non-thread-safe
|
|
||||||
* refcounts.
|
|
||||||
*/
|
|
||||||
virtual nsIMozBrowserFrame* GetAsMozBrowserFrame() { return nullptr; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the attribute named aAttribute a mapped attribute?
|
* Is the attribute named aAttribute a mapped attribute?
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include "nsFrameLoaderOwner.h"
|
#include "nsFrameLoaderOwner.h"
|
||||||
#include "nsQueryObject.h"
|
#include "nsQueryObject.h"
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
#include "nsIMozBrowserFrame.h"
|
|
||||||
#include "mozilla/EventDispatcher.h"
|
#include "mozilla/EventDispatcher.h"
|
||||||
#include "mozilla/dom/ChromeMessageSender.h"
|
#include "mozilla/dom/ChromeMessageSender.h"
|
||||||
#include "mozilla/dom/Document.h"
|
#include "mozilla/dom/Document.h"
|
||||||
|
@ -100,15 +99,6 @@ InProcessBrowserChildMessageManager::InProcessBrowserChildMessageManager(
|
||||||
mOwner(aOwner),
|
mOwner(aOwner),
|
||||||
mChromeMessageManager(aChrome) {
|
mChromeMessageManager(aChrome) {
|
||||||
mozilla::HoldJSObjects(this);
|
mozilla::HoldJSObjects(this);
|
||||||
|
|
||||||
// If owner corresponds to an <iframe mozbrowser>, we'll have to tweak our
|
|
||||||
// GetEventTargetParent implementation.
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwner);
|
|
||||||
if (browserFrame) {
|
|
||||||
mIsBrowserFrame = browserFrame->GetReallyIsBrowser();
|
|
||||||
} else {
|
|
||||||
mIsBrowserFrame = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InProcessBrowserChildMessageManager::~InProcessBrowserChildMessageManager() {
|
InProcessBrowserChildMessageManager::~InProcessBrowserChildMessageManager() {
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include "nsSubDocumentFrame.h"
|
#include "nsSubDocumentFrame.h"
|
||||||
#include "nsError.h"
|
#include "nsError.h"
|
||||||
#include "nsIAppWindow.h"
|
#include "nsIAppWindow.h"
|
||||||
#include "nsIMozBrowserFrame.h"
|
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
#include "nsGlobalWindowInner.h"
|
#include "nsGlobalWindowInner.h"
|
||||||
#include "nsGlobalWindowOuter.h"
|
#include "nsGlobalWindowOuter.h"
|
||||||
|
@ -262,13 +261,6 @@ static bool IsTopContent(BrowsingContext* aParent, Element* aOwner) {
|
||||||
return false;
|
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();
|
|
||||||
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 a xul browser element with a
|
// BrowsingContext tree if our element is a xul browser element with a
|
||||||
|
@ -365,17 +357,8 @@ static bool InitialLoadIsRemote(Element* aOwner) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're an <iframe mozbrowser> and we don't have a "remote" attribute,
|
// Otherwise, we're remote if we have "remote=true" and we're a XUL element.
|
||||||
// fall back to the default.
|
return (aOwner->GetNameSpaceID() == kNameSpaceID_XUL) &&
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(aOwner);
|
|
||||||
bool isMozBrowserFrame = browserFrame && browserFrame->GetReallyIsBrowser();
|
|
||||||
if (isMozBrowserFrame && !aOwner->HasAttr(nsGkAtoms::remote)) {
|
|
||||||
return Preferences::GetBool("dom.ipc.browser_frames.oop_by_default", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, we're remote if we have "remote=true" and we're either a
|
|
||||||
// browser frame or a XUL element.
|
|
||||||
return (isMozBrowserFrame || aOwner->GetNameSpaceID() == kNameSpaceID_XUL) &&
|
|
||||||
aOwner->AttrValueIs(kNameSpaceID_None, nsGkAtoms::remote,
|
aOwner->AttrValueIs(kNameSpaceID_None, nsGkAtoms::remote,
|
||||||
nsGkAtoms::_true, eCaseMatters);
|
nsGkAtoms::_true, eCaseMatters);
|
||||||
}
|
}
|
||||||
|
@ -706,12 +689,6 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
|
||||||
|
|
||||||
// Default flags:
|
// Default flags:
|
||||||
int32_t flags = nsIWebNavigation::LOAD_FLAGS_NONE;
|
int32_t flags = nsIWebNavigation::LOAD_FLAGS_NONE;
|
||||||
|
|
||||||
// Flags for browser frame:
|
|
||||||
if (OwnerIsMozBrowserFrame()) {
|
|
||||||
flags = nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
|
|
||||||
nsIWebNavigation::LOAD_FLAGS_DISALLOW_INHERIT_PRINCIPAL;
|
|
||||||
}
|
|
||||||
loadState->SetLoadFlags(flags);
|
loadState->SetLoadFlags(flags);
|
||||||
|
|
||||||
loadState->SetFirstParty(false);
|
loadState->SetFirstParty(false);
|
||||||
|
@ -875,14 +852,6 @@ static bool CheckDocShellType(mozilla::dom::Element* aOwnerContent,
|
||||||
bool isContent = aOwnerContent->AttrValueIs(kNameSpaceID_None, aAtom,
|
bool isContent = aOwnerContent->AttrValueIs(kNameSpaceID_None, aAtom,
|
||||||
nsGkAtoms::content, eIgnoreCase);
|
nsGkAtoms::content, eIgnoreCase);
|
||||||
|
|
||||||
if (!isContent) {
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> mozbrowser =
|
|
||||||
aOwnerContent->GetAsMozBrowserFrame();
|
|
||||||
if (mozbrowser) {
|
|
||||||
mozbrowser->GetMozbrowser(&isContent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isContent) {
|
if (isContent) {
|
||||||
return aDocShell->ItemType() == nsIDocShellTreeItem::typeContent;
|
return aDocShell->ItemType() == nsIDocShellTreeItem::typeContent;
|
||||||
}
|
}
|
||||||
|
@ -1156,7 +1125,6 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
|
||||||
if (nsCOMPtr<nsIObserverService> os = services::GetObserverService()) {
|
if (nsCOMPtr<nsIObserverService> os = services::GetObserverService()) {
|
||||||
os->NotifyObservers(ToSupports(this), "remote-browser-shown", nullptr);
|
os->NotifyObservers(ToSupports(this), "remote-browser-shown", nullptr);
|
||||||
}
|
}
|
||||||
ProcessPriorityManager::RemoteBrowserFrameShown(this);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nsIntRect dimensions;
|
nsIntRect dimensions;
|
||||||
|
@ -1329,14 +1297,6 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy browser frame scripts for content leaving a frame with browser API
|
|
||||||
if (OwnerIsMozBrowserFrame() && !aOther->OwnerIsMozBrowserFrame()) {
|
|
||||||
DestroyBrowserFrameScripts();
|
|
||||||
}
|
|
||||||
if (!OwnerIsMozBrowserFrame() && aOther->OwnerIsMozBrowserFrame()) {
|
|
||||||
aOther->DestroyBrowserFrameScripts();
|
|
||||||
}
|
|
||||||
|
|
||||||
otherBrowserParent->SetBrowserDOMWindow(browserDOMWindow);
|
otherBrowserParent->SetBrowserDOMWindow(browserDOMWindow);
|
||||||
browserParent->SetBrowserDOMWindow(otherBrowserDOMWindow);
|
browserParent->SetBrowserDOMWindow(otherBrowserDOMWindow);
|
||||||
|
|
||||||
|
@ -1405,10 +1365,6 @@ nsresult nsFrameLoader::SwapWithOtherRemoteLoader(
|
||||||
ourPresShell->BackingScaleFactorChanged();
|
ourPresShell->BackingScaleFactorChanged();
|
||||||
otherPresShell->BackingScaleFactorChanged();
|
otherPresShell->BackingScaleFactorChanged();
|
||||||
|
|
||||||
// Initialize browser API if needed now that owner content has changed.
|
|
||||||
InitializeBrowserAPI();
|
|
||||||
aOther->InitializeBrowserAPI();
|
|
||||||
|
|
||||||
mInSwap = aOther->mInSwap = false;
|
mInSwap = aOther->mInSwap = false;
|
||||||
|
|
||||||
// Send an updated tab context since owner content type may have changed.
|
// Send an updated tab context since owner content type may have changed.
|
||||||
|
@ -1536,13 +1492,8 @@ nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ourFullscreenAllowed = ourContent->IsXULElement() ||
|
bool ourFullscreenAllowed = ourContent->IsXULElement();
|
||||||
(OwnerIsMozBrowserFrame() &&
|
bool otherFullscreenAllowed = otherContent->IsXULElement();
|
||||||
ourContent->HasAttr(nsGkAtoms::allowfullscreen));
|
|
||||||
bool otherFullscreenAllowed =
|
|
||||||
otherContent->IsXULElement() ||
|
|
||||||
(aOther->OwnerIsMozBrowserFrame() &&
|
|
||||||
otherContent->HasAttr(nsGkAtoms::allowfullscreen));
|
|
||||||
if (ourFullscreenAllowed != otherFullscreenAllowed) {
|
if (ourFullscreenAllowed != otherFullscreenAllowed) {
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
@ -1732,14 +1683,6 @@ nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy browser frame scripts for content leaving a frame with browser API
|
|
||||||
if (OwnerIsMozBrowserFrame() && !aOther->OwnerIsMozBrowserFrame()) {
|
|
||||||
DestroyBrowserFrameScripts();
|
|
||||||
}
|
|
||||||
if (!OwnerIsMozBrowserFrame() && aOther->OwnerIsMozBrowserFrame()) {
|
|
||||||
aOther->DestroyBrowserFrameScripts();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now move the docshells to the right docshell trees. Note that this
|
// Now move the docshells to the right docshell trees. Note that this
|
||||||
// resets their treeowners to null.
|
// resets their treeowners to null.
|
||||||
ourParentItem->RemoveChild(ourDocshell);
|
ourParentItem->RemoveChild(ourDocshell);
|
||||||
|
@ -1837,10 +1780,6 @@ nsresult nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||||
ourFrame->PresShell()->BackingScaleFactorChanged();
|
ourFrame->PresShell()->BackingScaleFactorChanged();
|
||||||
otherFrame->PresShell()->BackingScaleFactorChanged();
|
otherFrame->PresShell()->BackingScaleFactorChanged();
|
||||||
|
|
||||||
// Initialize browser API if needed now that owner content has changed
|
|
||||||
InitializeBrowserAPI();
|
|
||||||
aOther->InitializeBrowserAPI();
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2174,11 +2113,6 @@ void nsFrameLoader::SetOwnerContent(Element* aContent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsFrameLoader::OwnerIsMozBrowserFrame() {
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
|
||||||
return browserFrame ? browserFrame->GetReallyIsBrowser() : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIContent* nsFrameLoader::GetParentObject() const { return mOwnerContent; }
|
nsIContent* nsFrameLoader::GetParentObject() const { return mOwnerContent; }
|
||||||
|
|
||||||
void nsFrameLoader::AssertSafeToInit() {
|
void nsFrameLoader::AssertSafeToInit() {
|
||||||
|
@ -2338,16 +2272,7 @@ nsresult nsFrameLoader::MaybeCreateDocShell() {
|
||||||
MOZ_ALWAYS_SUCCEEDS(mPendingBrowsingContext->SetInitialSandboxFlags(
|
MOZ_ALWAYS_SUCCEEDS(mPendingBrowsingContext->SetInitialSandboxFlags(
|
||||||
mPendingBrowsingContext->GetSandboxFlags()));
|
mPendingBrowsingContext->GetSandboxFlags()));
|
||||||
|
|
||||||
if (OwnerIsMozBrowserFrame()) {
|
|
||||||
// For inproc frames, set the docshell properties.
|
|
||||||
nsAutoString name;
|
|
||||||
if (mOwnerContent->GetAttr(nsGkAtoms::name, name)) {
|
|
||||||
docShell->SetName(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ReallyLoadFrameScripts();
|
ReallyLoadFrameScripts();
|
||||||
InitializeBrowserAPI();
|
|
||||||
|
|
||||||
// Previously we would forcibly create the initial about:blank document for
|
// Previously we would forcibly create the initial about:blank document for
|
||||||
// in-process content frames from a frame script which eagerly loaded in
|
// in-process content frames from a frame script which eagerly loaded in
|
||||||
|
@ -2588,11 +2513,8 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
|
||||||
// Graphics initialization code relies on having a frame for the
|
// Graphics initialization code relies on having a frame for the
|
||||||
// remote browser case, as we can be inside a popup, which is a different
|
// remote browser case, as we can be inside a popup, which is a different
|
||||||
// widget.
|
// widget.
|
||||||
//
|
|
||||||
// FIXME: Ideally this should be unconditional, but we skip if for <iframe
|
if (!mOwnerContent->GetPrimaryFrame()) {
|
||||||
// mozbrowser> because the old RDM ui depends on current behavior, and the
|
|
||||||
// mozbrowser frame code is scheduled for deletion, see bug 1574886.
|
|
||||||
if (!OwnerIsMozBrowserFrame() && !mOwnerContent->GetPrimaryFrame()) {
|
|
||||||
doc->FlushPendingNotifications(FlushType::Frames);
|
doc->FlushPendingNotifications(FlushType::Frames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2647,12 +2569,11 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
|
||||||
mPendingBrowsingContext->InitSessionHistory();
|
mPendingBrowsingContext->InitSessionHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
// <iframe mozbrowser> gets to skip these checks.
|
|
||||||
// iframes for JS plugins also get to skip these checks. We control the URL
|
// iframes for JS plugins also get to skip these checks. We control the URL
|
||||||
// that gets loaded, but the load is triggered from the document containing
|
// that gets loaded, but the load is triggered from the document containing
|
||||||
// the plugin.
|
// the plugin.
|
||||||
// out of process iframes also get to skip this check.
|
// out of process iframes also get to skip this check.
|
||||||
if (!OwnerIsMozBrowserFrame() && !XRE_IsContentProcess()) {
|
if (!XRE_IsContentProcess()) {
|
||||||
if (parentDocShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
|
if (parentDocShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
|
||||||
// Allow three exceptions to this rule :
|
// Allow three exceptions to this rule :
|
||||||
// - about:addons so it can load remote extension options pages
|
// - about:addons so it can load remote extension options pages
|
||||||
|
@ -2817,7 +2738,6 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ReallyLoadFrameScripts();
|
ReallyLoadFrameScripts();
|
||||||
InitializeBrowserAPI();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3053,7 +2973,7 @@ nsresult nsFrameLoader::EnsureMessageManager() {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mIsTopLevelContent && !OwnerIsMozBrowserFrame() && !IsRemoteFrame() &&
|
if (!mIsTopLevelContent && !IsRemoteFrame() &&
|
||||||
!(mOwnerContent->IsXULElement() &&
|
!(mOwnerContent->IsXULElement() &&
|
||||||
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
mOwnerContent->AttrValueIs(kNameSpaceID_None,
|
||||||
nsGkAtoms::forcemessagemanager,
|
nsGkAtoms::forcemessagemanager,
|
||||||
|
@ -3538,36 +3458,6 @@ BrowsingContext* nsFrameLoader::GetExtantBrowsingContext() {
|
||||||
return mPendingBrowsingContext;
|
return mPendingBrowsingContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsFrameLoader::InitializeBrowserAPI() {
|
|
||||||
if (!OwnerIsMozBrowserFrame()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = EnsureMessageManager();
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mMessageManager->LoadFrameScript(
|
|
||||||
u"chrome://global/content/BrowserElementChild.js"_ns,
|
|
||||||
/* allowDelayedLoad = */ true,
|
|
||||||
/* aRunInGlobalScope */ true, IgnoreErrors());
|
|
||||||
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
|
||||||
if (browserFrame) {
|
|
||||||
browserFrame->InitializeBrowserAPI();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsFrameLoader::DestroyBrowserFrameScripts() {
|
|
||||||
if (!OwnerIsMozBrowserFrame()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
|
||||||
if (browserFrame) {
|
|
||||||
browserFrame->DestroyBrowserFrameScripts();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsFrameLoader::StartPersistence(
|
void nsFrameLoader::StartPersistence(
|
||||||
BrowsingContext* aContext, nsIWebBrowserPersistDocumentReceiver* aRecv,
|
BrowsingContext* aContext, nsIWebBrowserPersistDocumentReceiver* aRecv,
|
||||||
ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
|
@ -3673,9 +3563,9 @@ nsresult nsFrameLoader::GetNewTabContext(MutableTabContext* aTabContext,
|
||||||
|
|
||||||
nsresult nsFrameLoader::PopulateOriginContextIdsFromAttributes(
|
nsresult nsFrameLoader::PopulateOriginContextIdsFromAttributes(
|
||||||
OriginAttributes& aAttr) {
|
OriginAttributes& aAttr) {
|
||||||
// Only XUL or mozbrowser frames are allowed to set context IDs
|
// Only XUL are allowed to set context IDs
|
||||||
uint32_t namespaceID = mOwnerContent->GetNameSpaceID();
|
uint32_t namespaceID = mOwnerContent->GetNameSpaceID();
|
||||||
if (namespaceID != kNameSpaceID_XUL && !OwnerIsMozBrowserFrame()) {
|
if (namespaceID != kNameSpaceID_XUL) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3899,8 +3789,7 @@ bool nsFrameLoader::EnsureBrowsingContextAttached() {
|
||||||
// Inherit the `mFirstPartyDomain` flag from our parent document's result
|
// Inherit the `mFirstPartyDomain` flag from our parent document's result
|
||||||
// principal, if it was set.
|
// principal, if it was set.
|
||||||
if (parentContext->IsContent() &&
|
if (parentContext->IsContent() &&
|
||||||
!parentDoc->NodePrincipal()->IsSystemPrincipal() &&
|
!parentDoc->NodePrincipal()->IsSystemPrincipal()) {
|
||||||
!OwnerIsMozBrowserFrame()) {
|
|
||||||
OriginAttributes docAttrs =
|
OriginAttributes docAttrs =
|
||||||
parentDoc->NodePrincipal()->OriginAttributesRef();
|
parentDoc->NodePrincipal()->OriginAttributesRef();
|
||||||
// We only want to inherit firstPartyDomain here, other attributes should
|
// We only want to inherit firstPartyDomain here, other attributes should
|
||||||
|
@ -3918,15 +3807,6 @@ bool nsFrameLoader::EnsureBrowsingContextAttached() {
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// <iframe mozbrowser> is allowed to set `mozprivatebrowsing` to
|
|
||||||
// force-enable private browsing.
|
|
||||||
if (OwnerIsMozBrowserFrame()) {
|
|
||||||
if (mOwnerContent->HasAttr(nsGkAtoms::mozprivatebrowsing)) {
|
|
||||||
attrs.SyncAttributesWithPrivateBrowsing(true);
|
|
||||||
usePrivateBrowsing = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we've already been attached, return.
|
// If we've already been attached, return.
|
||||||
|
|
|
@ -264,12 +264,6 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
||||||
|
|
||||||
bool IsNetworkCreated() const { return mNetworkCreated; }
|
bool IsNetworkCreated() const { return mNetworkCreated; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Is this a frame loader for a bona fide <iframe mozbrowser>?
|
|
||||||
* <xul:browser> is not a mozbrowser, so this is false for that case.
|
|
||||||
*/
|
|
||||||
bool OwnerIsMozBrowserFrame();
|
|
||||||
|
|
||||||
nsIContent* GetParentObject() const;
|
nsIContent* GetParentObject() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -481,9 +475,6 @@ class nsFrameLoader final : public nsStubMutationObserver,
|
||||||
void AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
void AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
|
||||||
nsIDocShellTreeOwner* aOwner);
|
nsIDocShellTreeOwner* aOwner);
|
||||||
|
|
||||||
void InitializeBrowserAPI();
|
|
||||||
void DestroyBrowserFrameScripts();
|
|
||||||
|
|
||||||
nsresult GetNewTabContext(mozilla::dom::MutableTabContext* aTabContext,
|
nsresult GetNewTabContext(mozilla::dom::MutableTabContext* aTabContext,
|
||||||
nsIURI* aURI = nullptr);
|
nsIURI* aURI = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -122,13 +122,6 @@ interface FrameLoader {
|
||||||
[Pure]
|
[Pure]
|
||||||
readonly attribute unsigned long long childID;
|
readonly attribute unsigned long long childID;
|
||||||
|
|
||||||
/**
|
|
||||||
* Find out whether the owner content really is a mozbrowser. <xul:browser>
|
|
||||||
* is not considered to be a mozbrowser frame.
|
|
||||||
*/
|
|
||||||
[Pure]
|
|
||||||
readonly attribute boolean ownerIsMozBrowserFrame;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last known width of the frame. Reading this property will not trigger
|
* The last known width of the frame. Reading this property will not trigger
|
||||||
* a reflow, and therefore may not reflect the current state of things. It
|
* a reflow, and therefore may not reflect the current state of things. It
|
||||||
|
|
|
@ -142,11 +142,6 @@ class HTMLIFrameElement final : public nsGenericHTMLFrameElement {
|
||||||
Document* GetSVGDocument(nsIPrincipal& aSubjectPrincipal) {
|
Document* GetSVGDocument(nsIPrincipal& aSubjectPrincipal) {
|
||||||
return GetContentDocument(aSubjectPrincipal);
|
return GetContentDocument(aSubjectPrincipal);
|
||||||
}
|
}
|
||||||
bool Mozbrowser() const { return GetBoolAttr(nsGkAtoms::mozbrowser); }
|
|
||||||
void SetMozbrowser(bool aAllow, ErrorResult& aError) {
|
|
||||||
SetHTMLBoolAttr(nsGkAtoms::mozbrowser, aAllow, aError);
|
|
||||||
}
|
|
||||||
using nsGenericHTMLFrameElement::SetMozbrowser;
|
|
||||||
// nsGenericHTMLFrameElement::GetFrameLoader is fine
|
// nsGenericHTMLFrameElement::GetFrameLoader is fine
|
||||||
// nsGenericHTMLFrameElement::GetAppManifestURL is fine
|
// nsGenericHTMLFrameElement::GetAppManifestURL is fine
|
||||||
|
|
||||||
|
|
|
@ -46,19 +46,10 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsGenericHTMLFrameElement,
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameLoader)
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameLoader)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(
|
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(nsGenericHTMLFrameElement,
|
||||||
nsGenericHTMLFrameElement, nsGenericHTMLElement, nsFrameLoaderOwner,
|
nsGenericHTMLElement,
|
||||||
nsIDOMMozBrowserFrame, nsIMozBrowserFrame, nsGenericHTMLFrameElement)
|
nsFrameLoaderOwner,
|
||||||
|
nsGenericHTMLFrameElement)
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericHTMLFrameElement::GetMozbrowser(bool* aValue) {
|
|
||||||
*aValue = GetBoolAttr(nsGkAtoms::mozbrowser);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericHTMLFrameElement::SetMozbrowser(bool aValue) {
|
|
||||||
return SetBoolAttr(nsGkAtoms::mozbrowser, aValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t nsGenericHTMLFrameElement::TabIndexDefault() { return 0; }
|
int32_t nsGenericHTMLFrameElement::TabIndexDefault() { return 0; }
|
||||||
|
|
||||||
|
@ -258,9 +249,6 @@ void nsGenericHTMLFrameElement::AfterSetAttr(
|
||||||
child->SendScrollbarPreferenceChanged(pref);
|
child->SendScrollbarPreferenceChanged(pref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (aName == nsGkAtoms::mozbrowser) {
|
|
||||||
mReallyIsBrowser = !!aValue && XRE_IsParentProcess() &&
|
|
||||||
NodePrincipal()->IsSystemPrincipal();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,26 +322,3 @@ bool nsGenericHTMLFrameElement::IsHTMLFocusable(bool aWithMouse,
|
||||||
*aIsFocusable = true;
|
*aIsFocusable = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if this frame element really is a mozbrowser. (It
|
|
||||||
* needs to have the right attributes, and its creator must have the right
|
|
||||||
* permissions.)
|
|
||||||
*/
|
|
||||||
/* [infallible] */
|
|
||||||
nsresult nsGenericHTMLFrameElement::GetReallyIsBrowser(bool* aOut) {
|
|
||||||
*aOut = mReallyIsBrowser;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericHTMLFrameElement::InitializeBrowserAPI() {
|
|
||||||
MOZ_ASSERT(mFrameLoader);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericHTMLFrameElement::DestroyBrowserFrameScripts() {
|
|
||||||
MOZ_ASSERT(mFrameLoader);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include "nsFrameLoader.h"
|
#include "nsFrameLoader.h"
|
||||||
#include "nsFrameLoaderOwner.h"
|
#include "nsFrameLoaderOwner.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsIMozBrowserFrame.h"
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
class ErrorResult;
|
class ErrorResult;
|
||||||
|
@ -37,23 +36,17 @@ class XULFrameElement;
|
||||||
* A helper class for frame elements
|
* A helper class for frame elements
|
||||||
*/
|
*/
|
||||||
class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
|
class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
|
||||||
public nsFrameLoaderOwner,
|
public nsFrameLoaderOwner {
|
||||||
public nsIMozBrowserFrame {
|
|
||||||
public:
|
public:
|
||||||
nsGenericHTMLFrameElement(
|
nsGenericHTMLFrameElement(
|
||||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||||
mozilla::dom::FromParser aFromParser)
|
mozilla::dom::FromParser aFromParser)
|
||||||
: nsGenericHTMLElement(std::move(aNodeInfo)),
|
: nsGenericHTMLElement(std::move(aNodeInfo)),
|
||||||
mSrcLoadHappened(false),
|
mSrcLoadHappened(false),
|
||||||
mNetworkCreated(aFromParser == mozilla::dom::FROM_PARSER_NETWORK),
|
mNetworkCreated(aFromParser == mozilla::dom::FROM_PARSER_NETWORK) {}
|
||||||
mBrowserFrameListenersRegistered(false),
|
|
||||||
mReallyIsBrowser(false) {}
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
NS_DECL_NSIDOMMOZBROWSERFRAME
|
|
||||||
NS_DECL_NSIMOZBROWSERFRAME
|
|
||||||
|
|
||||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_GENERICHTMLFRAMEELEMENT_IID)
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_GENERICHTMLFRAMEELEMENT_IID)
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
|
@ -67,8 +60,6 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
|
||||||
|
|
||||||
virtual int32_t TabIndexDefault() override;
|
virtual int32_t TabIndexDefault() override;
|
||||||
|
|
||||||
virtual nsIMozBrowserFrame* GetAsMozBrowserFrame() override { return this; }
|
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGenericHTMLFrameElement,
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGenericHTMLFrameElement,
|
||||||
nsGenericHTMLElement)
|
nsGenericHTMLElement)
|
||||||
|
|
||||||
|
@ -125,9 +116,6 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
|
||||||
*/
|
*/
|
||||||
bool mNetworkCreated;
|
bool mNetworkCreated;
|
||||||
|
|
||||||
bool mBrowserFrameListenersRegistered;
|
|
||||||
bool mReallyIsBrowser;
|
|
||||||
|
|
||||||
// This flag is only used by <iframe>. See HTMLIFrameElement::
|
// This flag is only used by <iframe>. See HTMLIFrameElement::
|
||||||
// FullscreenFlag() for details. It is placed here so that we
|
// FullscreenFlag() for details. It is placed here so that we
|
||||||
// do not bloat any struct.
|
// do not bloat any struct.
|
||||||
|
|
|
@ -9,7 +9,6 @@ with Files("**"):
|
||||||
|
|
||||||
XPIDL_SOURCES += [
|
XPIDL_SOURCES += [
|
||||||
"nsIDOMMozBrowserFrame.idl",
|
"nsIDOMMozBrowserFrame.idl",
|
||||||
"nsIMozBrowserFrame.idl",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
XPIDL_MODULE = "dom_html"
|
XPIDL_MODULE = "dom_html"
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim:set tw=80 expandtab softtabstop=2 ts=2 sw=2: */
|
|
||||||
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
||||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#include "nsIDOMMozBrowserFrame.idl"
|
|
||||||
|
|
||||||
interface nsIRemoteTab;
|
|
||||||
|
|
||||||
[scriptable, builtinclass, uuid(0c0a862c-1a47-43c0-ae9e-d51835e3e1a6)]
|
|
||||||
interface nsIMozBrowserFrame : nsIDOMMozBrowserFrame
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Gets whether this frame really is a browser frame.
|
|
||||||
*
|
|
||||||
* In order to really be a browser frame, this frame's
|
|
||||||
* nsIDOMMozBrowserFrame::mozbrowser attribute must be true, and the frame
|
|
||||||
* may have to pass various security checks.
|
|
||||||
*/
|
|
||||||
[infallible] readonly attribute boolean reallyIsBrowser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the API, and add frame message listener that supports API
|
|
||||||
* invocations.
|
|
||||||
*/
|
|
||||||
[noscript] void initializeBrowserAPI();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Notify frame scripts that support the API to destroy.
|
|
||||||
*/
|
|
||||||
[noscript] void destroyBrowserFrameScripts();
|
|
||||||
};
|
|
|
@ -213,7 +213,6 @@
|
||||||
#include "nsILocalStorageManager.h"
|
#include "nsILocalStorageManager.h"
|
||||||
#include "nsIMemoryInfoDumper.h"
|
#include "nsIMemoryInfoDumper.h"
|
||||||
#include "nsIMemoryReporter.h"
|
#include "nsIMemoryReporter.h"
|
||||||
#include "nsIMozBrowserFrame.h"
|
|
||||||
#include "nsINetworkLinkService.h"
|
#include "nsINetworkLinkService.h"
|
||||||
#include "nsIObserverService.h"
|
#include "nsIObserverService.h"
|
||||||
#include "nsIParentChannel.h"
|
#include "nsIParentChannel.h"
|
||||||
|
|
|
@ -1042,26 +1042,4 @@ void ProcessPriorityManager::BrowserPriorityChanged(
|
||||||
singleton->BrowserPriorityChanged(aBrowserParent, aPriority);
|
singleton->BrowserPriorityChanged(aBrowserParent, aPriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
|
||||||
void ProcessPriorityManager::RemoteBrowserFrameShown(
|
|
||||||
nsFrameLoader* aFrameLoader) {
|
|
||||||
ProcessPriorityManagerImpl* singleton =
|
|
||||||
ProcessPriorityManagerImpl::GetSingleton();
|
|
||||||
if (!singleton) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BrowserParent* bp = BrowserParent::GetFrom(aFrameLoader);
|
|
||||||
NS_ENSURE_TRUE_VOID(bp);
|
|
||||||
|
|
||||||
MOZ_ASSERT(XRE_IsParentProcess());
|
|
||||||
|
|
||||||
// Ignore calls that aren't from a Browser.
|
|
||||||
if (!aFrameLoader->OwnerIsMozBrowserFrame()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
singleton->ResetPriority(bp->Manager());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -80,8 +80,6 @@ class ProcessPriorityManager final {
|
||||||
static void BrowserPriorityChanged(dom::BrowserParent* aBrowserParent,
|
static void BrowserPriorityChanged(dom::BrowserParent* aBrowserParent,
|
||||||
bool aPriority);
|
bool aPriority);
|
||||||
|
|
||||||
static void RemoteBrowserFrameShown(nsFrameLoader* aFrameLoader);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProcessPriorityManager();
|
ProcessPriorityManager();
|
||||||
ProcessPriorityManager(const ProcessPriorityManager&) = delete;
|
ProcessPriorityManager(const ProcessPriorityManager&) = delete;
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "nsCanvasFrame.h"
|
#include "nsCanvasFrame.h"
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "nsSubDocumentFrame.h"
|
#include "nsSubDocumentFrame.h"
|
||||||
#include "nsIMozBrowserFrame.h"
|
|
||||||
#include "nsPlaceholderFrame.h"
|
#include "nsPlaceholderFrame.h"
|
||||||
#include "MobileViewportManager.h"
|
#include "MobileViewportManager.h"
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#include "mozilla/dom/DocumentInlines.h"
|
#include "mozilla/dom/DocumentInlines.h"
|
||||||
#include "nsILoadContext.h"
|
#include "nsILoadContext.h"
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
#include "nsIMozBrowserFrame.h"
|
|
||||||
#include "nsINode.h"
|
#include "nsINode.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsFontMetrics.h"
|
#include "nsFontMetrics.h"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче