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

@@ -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) {