Bug 1525720, part 13 - Stop inheriting nsIRemoteTab interface in BrowserParent. r=nika

This commit removes nsIRemoteTab as a parent class from BrowserParent,
so that BrowserHost is the only concrete implementation of nsIRemoteTab.

Some static_cast's are updated to cast to BrowserHost, and other places
have to be updated to pass a BrowserHost instead of a BrowserParent.

WindowGlobalParent had a getter to return it's managing BrowserParent
as a nsIRemoteTab. I couldn't find a use of this in-tree, so I've just
opt-ed to remove it. If there's a use-case, we can add something back
in.

Differential Revision: https://phabricator.services.mozilla.com/D31444
This commit is contained in:
Ryan Hunt
2019-05-08 14:34:47 -05:00
parent 0ee34f47f3
commit eda6ea6e51
16 changed files with 122 additions and 76 deletions

View File

@@ -27,6 +27,7 @@
#include "mozilla/dom/CustomEvent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/BrowserHost.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
@@ -669,12 +670,12 @@ ProxyAccessible* RootAccessible::GetPrimaryRemoteTopLevelContentDoc() const {
mDocumentNode->GetDocShell()->GetTreeOwner(getter_AddRefs(owner));
NS_ENSURE_TRUE(owner, nullptr);
nsCOMPtr<nsIRemoteTab> browserParent;
owner->GetPrimaryRemoteTab(getter_AddRefs(browserParent));
if (!browserParent) {
nsCOMPtr<nsIRemoteTab> remoteTab;
owner->GetPrimaryRemoteTab(getter_AddRefs(remoteTab));
if (!remoteTab) {
return nullptr;
}
auto tab = static_cast<dom::BrowserParent*>(browserParent.get());
auto tab = static_cast<dom::BrowserHost*>(remoteTab.get());
return tab->GetTopLevelDocAccessible();
}

View File

@@ -2599,13 +2599,10 @@ bool nsFrameLoader::TryRemoteBrowser() {
return false;
}
BrowserParent* openingTab =
BrowserParent::GetFrom(parentDocShell->GetOpener());
RefPtr<ContentParent> openerContentParent;
RefPtr<BrowserParent> sameTabGroupAs;
if (openingTab && openingTab->Manager()) {
openerContentParent = openingTab->Manager();
if (auto* host = BrowserHost::GetFrom(parentDocShell->GetOpener())) {
openerContentParent = host->GetActor()->Manager();
}
// <iframe mozbrowser> gets to skip these checks.
@@ -3367,12 +3364,12 @@ void nsFrameLoader::StartPersistence(
void nsFrameLoader::MaybeUpdatePrimaryBrowserParent(
BrowserParentChange aChange) {
if (!mOwnerContent) {
if (!mOwnerContent || !mRemoteBrowser) {
return;
}
RefPtr<BrowserParent> browserParent = GetBrowserParent();
if (!browserParent) {
RefPtr<BrowserHost> browserHost = mRemoteBrowser->AsBrowserHost();
if (!browserHost) {
return;
}
@@ -3397,11 +3394,11 @@ void nsFrameLoader::MaybeUpdatePrimaryBrowserParent(
mObservingOwnerContent = true;
}
parentTreeOwner->RemoteTabRemoved(browserParent);
parentTreeOwner->RemoteTabRemoved(browserHost);
if (aChange == eBrowserParentChanged) {
bool isPrimary = mOwnerContent->AttrValueIs(
kNameSpaceID_None, nsGkAtoms::primary, nsGkAtoms::_true, eIgnoreCase);
parentTreeOwner->RemoteTabAdded(browserParent, isPrimary);
parentTreeOwner->RemoteTabAdded(browserHost, isPrimary);
}
}

View File

@@ -23,8 +23,6 @@ interface WindowGlobalParent {
readonly attribute WindowGlobalChild? childActor; // in-process only
readonly attribute RemoteTab? remoteTab; // out-of-process only
// Information about the currently loaded document.
readonly attribute Principal documentPrincipal;
readonly attribute URI? documentURI;

View File

@@ -18,6 +18,10 @@ BrowserHost::BrowserHost(BrowserParent* aParent) : mRoot(aParent) {
mRoot->SetBrowserHost(this);
}
BrowserHost* BrowserHost::GetFrom(nsIRemoteTab* aRemoteTab) {
return static_cast<BrowserHost*>(aRemoteTab);
}
mozilla::layers::LayersId BrowserHost::GetLayersId() const {
return mRoot->GetRenderFrame()->GetLayersId();
}
@@ -31,6 +35,10 @@ nsILoadContext* BrowserHost::GetLoadContext() const {
return loadContext;
}
a11y::DocAccessibleParent* BrowserHost::GetTopLevelDocAccessible() const {
return mRoot->GetTopLevelDocAccessible();
}
void BrowserHost::LoadURL(nsIURI* aURI) { mRoot->LoadURL(aURI); }
void BrowserHost::ResumeLoad(uint64_t aPendingSwitchId) {

View File

@@ -11,9 +11,18 @@
#include "mozilla/dom/RemoteBrowser.h"
#include "mozilla/dom/BrowserParent.h"
class nsPIDOMWindowOuter;
namespace mozilla {
namespace a11y {
class DocAccessibleParent;
} // namespace a11y
namespace dom {
class Element;
/**
* BrowserHost manages a remote browser from the chrome process.
*
@@ -29,6 +38,8 @@ class BrowserHost : public RemoteBrowser, public nsIRemoteTab {
explicit BrowserHost(BrowserParent* aParent);
static BrowserHost* GetFrom(nsIRemoteTab* aRemoteTab);
NS_DECL_ISUPPORTS
// nsIRemoteTab
NS_DECL_NSIREMOTETAB
@@ -44,6 +55,12 @@ class BrowserHost : public RemoteBrowser, public nsIRemoteTab {
BrowsingContext* GetBrowsingContext() const override;
nsILoadContext* GetLoadContext() const override;
Element* GetOwnerElement() const { return mRoot->GetOwnerElement(); }
already_AddRefed<nsPIDOMWindowOuter> GetParentWindowOuter() const {
return mRoot->GetParentWindowOuter();
}
a11y::DocAccessibleParent* GetTopLevelDocAccessible() const;
void LoadURL(nsIURI* aURI) override;
void ResumeLoad(uint64_t aPendingSwitchId) override;
void DestroyStart() override;

View File

@@ -160,10 +160,9 @@ BrowserParent::LayerToBrowserParentTable*
BrowserParent::sLayerToBrowserParentTable = nullptr;
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserParent)
NS_INTERFACE_MAP_ENTRY(nsIRemoteTab)
NS_INTERFACE_MAP_ENTRY(nsIAuthPromptProvider)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRemoteTab)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventListener)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION(BrowserParent, mFrameElement, mBrowserDOMWindow,
mLoadContext, mFrameLoader, mBrowsingContext)
@@ -260,11 +259,6 @@ BrowserParent* BrowserParent::GetFrom(nsFrameLoader* aFrameLoader) {
return aFrameLoader->GetBrowserParent();
}
/*static*/
BrowserParent* BrowserParent::GetFrom(nsIRemoteTab* aBrowserParent) {
return static_cast<BrowserParent*>(aBrowserParent);
}
/*static*/
BrowserParent* BrowserParent::GetFrom(PBrowserParent* aBrowserParent) {
return static_cast<BrowserParent*>(aBrowserParent);
@@ -484,15 +478,15 @@ void BrowserParent::SetOwnerElement(Element* aElement) {
newTopLevelWin = nsContentUtils::GetWindowRoot(aElement->OwnerDoc());
}
bool isSameTopLevelWin = curTopLevelWin == newTopLevelWin;
if (curTopLevelWin && !isSameTopLevelWin) {
curTopLevelWin->RemoveBrowser(this);
if (mBrowserHost && curTopLevelWin && !isSameTopLevelWin) {
curTopLevelWin->RemoveBrowser(mBrowserHost);
}
// Update to the new content, and register to listen for events from it.
mFrameElement = aElement;
if (newTopLevelWin && !isSameTopLevelWin) {
newTopLevelWin->AddBrowser(this);
if (mBrowserHost && newTopLevelWin && !isSameTopLevelWin) {
newTopLevelWin->AddBrowser(mBrowserHost);
}
if (mFrameElement) {
@@ -731,9 +725,8 @@ void BrowserParent::ActorDestroy(ActorDestroyReason why) {
}
mFrameLoader = nullptr;
if (os) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIRemoteTab*, this),
if (os && mBrowserHost) {
os->NotifyObservers(NS_ISUPPORTS_CAST(nsIRemoteTab*, mBrowserHost),
"ipc:browser-destroyed", nullptr);
}
}

View File

@@ -86,7 +86,6 @@ class StructuredCloneData;
*/
class BrowserParent final : public PBrowserParent,
public nsIDOMEventListener,
public nsIRemoteTab,
public nsIAuthPromptProvider,
public nsIKeyEventInPluginCallback,
public nsSupportsWeakReference,
@@ -104,12 +103,10 @@ class BrowserParent final : public PBrowserParent,
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIAUTHPROMPTPROVIDER
// nsIRemoteTab
NS_DECL_NSIREMOTETAB
// nsIDOMEventListener interfaces
NS_DECL_NSIDOMEVENTLISTENER
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(BrowserParent, nsIRemoteTab)
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(BrowserParent, nsIDOMEventListener)
BrowserParent(ContentParent* aManager, const TabId& aTabId,
const TabContext& aContext,
@@ -127,8 +124,6 @@ class BrowserParent final : public PBrowserParent,
static BrowserParent* GetFrom(nsFrameLoader* aFrameLoader);
static BrowserParent* GetFrom(nsIRemoteTab* aBrowserParent);
static BrowserParent* GetFrom(PBrowserParent* aBrowserParent);
static BrowserParent* GetFrom(nsIContent* aContent);
@@ -678,6 +673,35 @@ class BrowserParent final : public PBrowserParent,
void SkipBrowsingContextDetach();
NS_IMETHOD GetDocShellIsActive(bool* aDocShellIsActive);
NS_IMETHOD SetDocShellIsActive(bool aDocShellIsActive);
NS_IMETHOD GetRenderLayers(bool* aRenderLayers);
NS_IMETHOD SetRenderLayers(bool aRenderLayers);
NS_IMETHOD GetHasLayers(bool* aHasLayers);
NS_IMETHOD ForceRepaint(void);
NS_IMETHOD NotifyResolutionChanged(void);
NS_IMETHOD Deprioritize(void);
NS_IMETHOD PreserveLayers(bool aPreserveLayers);
NS_IMETHOD GetTabId(uint64_t* aTabId);
NS_IMETHOD GetContentProcessId(uint64_t* aContentProcessId);
NS_IMETHOD GetOsPid(int32_t* aOsPid);
NS_IMETHOD GetHasContentOpener(bool* aHasContentOpener);
NS_IMETHOD GetHasPresented(bool* aHasPresented);
NS_IMETHOD GetWindowGlobalParents(
nsTArray<RefPtr<WindowGlobalParent>>& aWindowGlobalParents);
NS_IMETHOD TransmitPermissionsForPrincipal(nsIPrincipal* aPrincipal);
NS_IMETHOD GetHasBeforeUnload(bool* aHasBeforeUnload);
NS_IMETHOD GetOwnerElement(mozilla::dom::Element** aOwnerElement);
NS_IMETHOD StartApzAutoscroll(float aAnchorX, float aAnchorY,
nsViewID aScrollId, uint32_t aPresShellId,
bool* _retval);
NS_IMETHOD StopApzAutoscroll(nsViewID aScrollId, uint32_t aPresShellId);
NS_IMETHOD SaveRecording(const nsAString& aFileName, bool* _retval);
NS_IMETHOD GetContentBlockingLog(::mozilla::dom::Promise** _retval);
NS_IMETHOD MaybeCancelContentJSExecutionFromScript(
nsIRemoteTab::NavigationType aNavigationType,
JS::Handle<JS::Value> aCancelContentJSOptions, JSContext* aCx);
protected:
friend BrowserBridgeParent;
friend BrowserHost;

View File

@@ -4683,7 +4683,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
const bool& aCalledFromJS, const bool& aPositionSpecified,
const bool& aSizeSpecified, nsIURI* aURIToLoad, const nsCString& aFeatures,
const float& aFullZoom, uint64_t aNextRemoteTabId, const nsString& aName,
nsresult& aResult, nsCOMPtr<nsIRemoteTab>& aNewBrowserParent,
nsresult& aResult, nsCOMPtr<nsIRemoteTab>& aNewRemoteTab,
bool* aWindowIsNew, int32_t& aOpenLocation,
nsIPrincipal* aTriggeringPrincipal, nsIReferrerInfo* aReferrerInfo,
bool aLoadURI, nsIContentSecurityPolicy* aCsp)
@@ -4700,6 +4700,9 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
}
BrowserParent* thisBrowserParent = BrowserParent::GetFrom(aThisTab);
BrowserHost* thisBrowserHost =
thisBrowserParent ? thisBrowserParent->GetBrowserHost() : nullptr;
MOZ_ASSERT(!thisBrowserParent == !thisBrowserHost);
nsCOMPtr<nsIContent> frame;
if (thisBrowserParent) {
frame = thisBrowserParent->GetOwnerElement();
@@ -4749,8 +4752,8 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
// Read the origin attributes for the tab from the opener browserParent.
OriginAttributes openerOriginAttributes;
if (thisBrowserParent) {
nsCOMPtr<nsILoadContext> loadContext = thisBrowserParent->GetLoadContext();
if (thisBrowserHost) {
nsCOMPtr<nsILoadContext> loadContext = thisBrowserHost->GetLoadContext();
loadContext->GetOriginAttributes(openerOriginAttributes);
} else if (Preferences::GetBool("browser.privatebrowsing.autostart")) {
openerOriginAttributes.mPrivateBrowsingId = 1;
@@ -4786,7 +4789,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
if (NS_SUCCEEDED(aResult) && frameLoaderOwner) {
RefPtr<nsFrameLoader> frameLoader = frameLoaderOwner->GetFrameLoader();
if (frameLoader) {
aNewBrowserParent = frameLoader->GetRemoteTab();
aNewRemoteTab = frameLoader->GetRemoteTab();
// At this point, it's possible the inserted frameloader hasn't gone
// through layout yet. To ensure that the dimensions that we send down
// when telling the frameloader to display will be correct (instead of
@@ -4816,13 +4819,15 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
}
aResult = pwwatch->OpenWindowWithRemoteTab(
thisBrowserParent, aFeatures, aCalledFromJS, aFullZoom, aNextRemoteTabId,
!aSetOpener, getter_AddRefs(aNewBrowserParent));
thisBrowserHost, aFeatures, aCalledFromJS, aFullZoom, aNextRemoteTabId,
!aSetOpener, getter_AddRefs(aNewRemoteTab));
if (NS_WARN_IF(NS_FAILED(aResult))) {
return IPC_OK();
}
MOZ_ASSERT(aNewBrowserParent);
MOZ_ASSERT(aNewRemoteTab);
BrowserHost* newBrowserHost = BrowserHost::GetFrom(aNewRemoteTab.get());
BrowserParent* newBrowserParent = newBrowserHost->GetActor();
// At this point, it's possible the inserted frameloader hasn't gone through
// layout yet. To ensure that the dimensions that we send down when telling
@@ -4833,8 +4838,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
// This involves doing a bit of gymnastics in order to get at the FrameLoader,
// so we scope this to avoid polluting the main function scope.
{
nsCOMPtr<Element> frameElement =
BrowserParent::GetFrom(aNewBrowserParent)->GetOwnerElement();
nsCOMPtr<Element> frameElement = newBrowserHost->GetOwnerElement();
MOZ_ASSERT(frameElement);
RefPtr<nsFrameLoaderOwner> frameLoaderOwner = do_QueryObject(frameElement);
MOZ_ASSERT(frameLoaderOwner);
@@ -4846,8 +4850,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
// If we were passed a name for the window which would override the default,
// we should send it down to the new tab.
if (nsContentUtils::IsOverridingWindowName(aName)) {
Unused
<< BrowserParent::GetFrom(aNewBrowserParent)->SendSetWindowName(aName);
Unused << newBrowserParent->SendSetWindowName(aName);
}
// Don't send down the OriginAttributes if the content process is handling
@@ -4856,8 +4859,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
// If we send it down in the non-async case, then we might set the
// OriginAttributes after the document has already navigated.
if (!aSetOpener) {
Unused << BrowserParent::GetFrom(aNewBrowserParent)
->SendSetOriginAttributes(openerOriginAttributes);
Unused << newBrowserParent->SendSetOriginAttributes(openerOriginAttributes);
}
if (aURIToLoad && aLoadURI) {
@@ -4866,7 +4868,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
openerWindow = thisBrowserParent->GetParentWindowOuter();
}
nsCOMPtr<nsIBrowserDOMWindow> newBrowserDOMWin =
BrowserParent::GetFrom(aNewBrowserParent)->GetBrowserDOMWindow();
newBrowserParent->GetBrowserDOMWindow();
if (NS_WARN_IF(!newBrowserDOMWin)) {
aResult = NS_ERROR_ABORT;
return IPC_OK();
@@ -4946,7 +4948,8 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
if (sNextBrowserParents.GetAndRemove(nextRemoteTabId).valueOr(nullptr)) {
cwi.windowOpened() = false;
}
MOZ_ASSERT(BrowserParent::GetFrom(newRemoteTab) == newTab);
MOZ_ASSERT(BrowserHost::GetFrom(newRemoteTab.get()) ==
newTab->GetBrowserHost());
newTab->SwapFrameScriptsFrom(cwi.frameScripts());
newTab->MaybeShowFrame();

View File

@@ -681,7 +681,7 @@ class ContentParent final : public PContentParent,
const bool& aSizeSpecified, nsIURI* aURIToLoad,
const nsCString& aFeatures, const float& aFullZoom,
uint64_t aNextRemoteTabId, const nsString& aName, nsresult& aResult,
nsCOMPtr<nsIRemoteTab>& aNewBrowserParent, bool* aWindowIsNew,
nsCOMPtr<nsIRemoteTab>& aNewRemoteTab, bool* aWindowIsNew,
int32_t& aOpenLocation, nsIPrincipal* aTriggeringPrincipal,
nsIReferrerInfo* aReferrerInfo, bool aLoadUri,
nsIContentSecurityPolicy* aCsp);

View File

@@ -72,7 +72,7 @@ void JSWindowActorParent::SendRawMessage(const JSWindowActorMessageMeta& aMeta,
// Cross-process case - send data over WindowGlobalParent to other side.
ClonedMessageData msgData;
RefPtr<BrowserParent> browserParent = mManager->GetRemoteTab();
RefPtr<BrowserParent> browserParent = mManager->GetBrowserParent();
ContentParent* cp = browserParent->Manager();
if (NS_WARN_IF(!aData.BuildClonedMessageDataForParent(cp, msgData))) {
aRv.Throw(NS_ERROR_DOM_DATA_CLONE_ERR);

View File

@@ -8,6 +8,7 @@
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/BrowserHost.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/Hal.h"
#include "mozilla/IntegerPrintfMacros.h"
@@ -683,16 +684,18 @@ void ParticularProcessPriorityManager::OnRemoteBrowserFrameShown(
void ParticularProcessPriorityManager::OnBrowserParentDestroyed(
nsISupports* aSubject) {
nsCOMPtr<nsIRemoteTab> tp = do_QueryInterface(aSubject);
NS_ENSURE_TRUE_VOID(tp);
nsCOMPtr<nsIRemoteTab> remoteTab = do_QueryInterface(aSubject);
NS_ENSURE_TRUE_VOID(remoteTab);
BrowserHost* browserHost = BrowserHost::GetFrom(remoteTab.get());
BrowserParent* browserParent = browserHost->GetActor();
MOZ_ASSERT(XRE_IsParentProcess());
if (BrowserParent::GetFrom(tp)->Manager() != mContentParent) {
if (browserParent->Manager() != mContentParent) {
return;
}
uint64_t tabId;
if (NS_WARN_IF(NS_FAILED(tp->GetTabId(&tabId)))) {
if (NS_WARN_IF(NS_FAILED(browserParent->GetTabId(&tabId)))) {
return;
}

View File

@@ -11,6 +11,7 @@
#include "mozilla/dom/BrowserBridgeParent.h"
#include "mozilla/dom/CanonicalBrowsingContext.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/BrowserHost.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/WindowGlobalActorsBinding.h"
#include "mozilla/dom/WindowGlobalChild.h"
@@ -143,7 +144,7 @@ already_AddRefed<WindowGlobalChild> WindowGlobalParent::GetChildActor() {
return do_AddRef(static_cast<WindowGlobalChild*>(otherSide));
}
already_AddRefed<BrowserParent> WindowGlobalParent::GetRemoteTab() {
already_AddRefed<BrowserParent> WindowGlobalParent::GetBrowserParent() {
if (IsInProcess() || mIPCClosed) {
return nullptr;
}
@@ -164,7 +165,7 @@ IPCResult WindowGlobalParent::RecvBecomeCurrentWindowGlobal() {
IPCResult WindowGlobalParent::RecvDestroy() {
if (!mIPCClosed) {
RefPtr<BrowserParent> browserParent = GetRemoteTab();
RefPtr<BrowserParent> browserParent = GetBrowserParent();
if (!browserParent || !browserParent->IsDestroyed()) {
// Make a copy so that we can avoid potential iterator invalidation when
// calling the user-provided Destroy() methods.
@@ -200,7 +201,7 @@ void WindowGlobalParent::ReceiveRawMessage(
}
const nsAString& WindowGlobalParent::GetRemoteType() {
if (RefPtr<BrowserParent> browserParent = GetRemoteTab()) {
if (RefPtr<BrowserParent> browserParent = GetBrowserParent()) {
return browserParent->Manager()->GetRemoteType();
}
@@ -253,7 +254,7 @@ IPCResult WindowGlobalParent::RecvDidEmbedBrowsingContext(
already_AddRefed<Promise> WindowGlobalParent::ChangeFrameRemoteness(
dom::BrowsingContext* aBc, const nsAString& aRemoteType,
uint64_t aPendingSwitchId, ErrorResult& aRv) {
RefPtr<BrowserParent> browserParent = GetRemoteTab();
RefPtr<BrowserParent> browserParent = GetBrowserParent();
if (NS_WARN_IF(!browserParent)) {
aRv.Throw(NS_ERROR_FAILURE);
return nullptr;

View File

@@ -64,7 +64,7 @@ class WindowGlobalParent final : public WindowGlobalActor,
// Get this actor's manager if it is not an in-process actor. Returns
// |nullptr| if the actor has been torn down, or is in-process.
already_AddRefed<BrowserParent> GetRemoteTab();
already_AddRefed<BrowserParent> GetBrowserParent();
void ReceiveRawMessage(const JSWindowActorMessageMeta& aMeta,
ipc::StructuredCloneData&& aData);

View File

@@ -22,7 +22,7 @@
#include "mozilla/Unused.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/BrowserHost.h"
#include "nsIContentPolicy.h"
#include "nsIHttpChannelInternal.h"
#include "nsIHttpHeaderVisitor.h"
@@ -140,10 +140,10 @@ already_AddRefed<ChannelWrapper> ChannelWrapper::Get(const GlobalObject& global,
already_AddRefed<ChannelWrapper> ChannelWrapper::GetRegisteredChannel(
const GlobalObject& global, uint64_t aChannelId,
const WebExtensionPolicy& aAddon, nsIRemoteTab* aBrowserParent) {
const WebExtensionPolicy& aAddon, nsIRemoteTab* aRemoteTab) {
ContentParent* contentParent = nullptr;
if (BrowserParent* parent = static_cast<BrowserParent*>(aBrowserParent)) {
contentParent = parent->Manager();
if (BrowserHost* host = BrowserHost::GetFrom(aRemoteTab)) {
contentParent = host->GetActor()->Manager();
}
auto& webreq = WebRequestService::GetSingleton();
@@ -682,12 +682,12 @@ void ChannelWrapper::RegisterTraceableChannel(const WebExtensionPolicy& aAddon,
already_AddRefed<nsITraceableChannel> ChannelWrapper::GetTraceableChannel(
nsAtom* aAddonId, dom::ContentParent* aContentParent) const {
nsCOMPtr<nsIRemoteTab> browserParent;
if (mAddonEntries.Get(aAddonId, getter_AddRefs(browserParent))) {
nsCOMPtr<nsIRemoteTab> remoteTab;
if (mAddonEntries.Get(aAddonId, getter_AddRefs(remoteTab))) {
ContentParent* contentParent = nullptr;
if (browserParent) {
if (remoteTab) {
contentParent =
static_cast<BrowserParent*>(browserParent.get())->Manager();
BrowserHost::GetFrom(remoteTab.get())->GetActor()->Manager();
}
if (contentParent == aContentParent) {

View File

@@ -66,6 +66,7 @@
#include "mozilla/dom/Storage.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/BrowserParent.h"
#include "mozilla/dom/BrowserHost.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/TabGroup.h"
#include "nsIXULWindow.h"
@@ -476,7 +477,7 @@ nsWindowWatcher::OpenWindowWithRemoteTab(
if (aRemoteTab) {
// We need to examine the window that aRemoteTab belongs to in
// order to inform us of what kind of window we're going to open.
BrowserParent* openingTab = BrowserParent::GetFrom(aRemoteTab);
BrowserHost* openingTab = BrowserHost::GetFrom(aRemoteTab);
parentWindowOuter = openingTab->GetParentWindowOuter();
// Propagate the privacy & fission status of the parent window, if

View File

@@ -59,6 +59,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/BrowserHost.h"
#include "mozilla/dom/BrowserParent.h"
#ifdef MOZ_NEW_XULSTORE
@@ -352,9 +353,8 @@ nsTArray<RefPtr<mozilla::LiveResizeListener>>
nsXULWindow::GetLiveResizeListeners() {
nsTArray<RefPtr<mozilla::LiveResizeListener>> listeners;
if (mPrimaryBrowserParent) {
BrowserParent* parent =
static_cast<BrowserParent*>(mPrimaryBrowserParent.get());
listeners.AppendElement(parent);
BrowserHost* host = BrowserHost::GetFrom(mPrimaryBrowserParent.get());
listeners.AppendElement(host->GetActor());
}
return listeners;
}
@@ -1864,9 +1864,9 @@ nsXULWindow::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) {
nsresult nsXULWindow::GetPrimaryRemoteTabSize(int32_t* aWidth,
int32_t* aHeight) {
BrowserParent* browserParent = BrowserParent::GetFrom(mPrimaryBrowserParent);
BrowserHost* host = BrowserHost::GetFrom(mPrimaryBrowserParent.get());
// Need strong ref, since Client* can run script.
nsCOMPtr<Element> element = browserParent->GetOwnerElement();
nsCOMPtr<Element> element = host->GetOwnerElement();
NS_ENSURE_STATE(element);
*aWidth = element->ClientWidth();