Bug 1633820 - Part 3: Get rid of PBrowserOrId, r=mattwoodrow,necko-reviewers,dragana

The 'Id' variant was only used with b2g for remote `mozbrowser`s, and is no
longer relevant. The new code instead uses `PBrowser` directly in all cases.

Differential Revision: https://phabricator.services.mozilla.com/D72933
This commit is contained in:
Nika Layzell 2020-05-07 17:45:12 +00:00
Родитель 51df83bff7
Коммит dd35cc6b02
22 изменённых файлов: 90 добавлений и 202 удалений

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/Preferences.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI
#include "mozilla/dom/BrowsingContext.h"
#include "nsContentUtils.h"
#include "xpcpublic.h"
@ -17,6 +18,32 @@ namespace mozilla {
NS_IMPL_ISUPPORTS(LoadContext, nsILoadContext, nsIInterfaceRequestor)
LoadContext::LoadContext(const IPC::SerializedLoadContext& aToCopy,
dom::Element* aTopFrameElement,
OriginAttributes& aAttrs)
: mTopFrameElement(do_GetWeakReference(aTopFrameElement)),
mIsContent(aToCopy.mIsContent),
mUseRemoteTabs(aToCopy.mUseRemoteTabs),
mUseRemoteSubframes(aToCopy.mUseRemoteSubframes),
mUseTrackingProtection(aToCopy.mUseTrackingProtection),
#ifdef DEBUG
mIsNotNull(aToCopy.mIsNotNull),
#endif
mOriginAttributes(aAttrs) {
}
LoadContext::LoadContext(OriginAttributes& aAttrs)
: mTopFrameElement(nullptr),
mIsContent(false),
mUseRemoteTabs(false),
mUseRemoteSubframes(false),
mUseTrackingProtection(false),
#ifdef DEBUG
mIsNotNull(true),
#endif
mOriginAttributes(aAttrs) {
}
LoadContext::LoadContext(nsIPrincipal* aPrincipal,
nsILoadContext* aOptionalBase)
: mTopFrameElement(nullptr),
@ -40,6 +67,8 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal,
aOptionalBase->GetUseTrackingProtection(&mUseTrackingProtection));
}
LoadContext::~LoadContext() = default;
//-----------------------------------------------------------------------------
// LoadContext::nsILoadContext
//-----------------------------------------------------------------------------

Просмотреть файл

@ -22,7 +22,7 @@ namespace mozilla {
* from Child via SerializedLoadContext.
*
* Note: this is not the "normal" or "original" nsILoadContext. That is
* typically provided by nsDocShell. This is only used when the original
* typically provided by BrowsingContext. This is only used when the original
* docshell is in a different process and we need to copy certain values from
* it.
*/
@ -34,54 +34,17 @@ class LoadContext final : public nsILoadContext, public nsIInterfaceRequestor {
NS_DECL_NSIINTERFACEREQUESTOR
LoadContext(const IPC::SerializedLoadContext& aToCopy,
dom::Element* aTopFrameElement, OriginAttributes& aAttrs)
: mTopFrameElement(do_GetWeakReference(aTopFrameElement)),
mIsContent(aToCopy.mIsContent),
mUseRemoteTabs(aToCopy.mUseRemoteTabs),
mUseRemoteSubframes(aToCopy.mUseRemoteSubframes),
mUseTrackingProtection(aToCopy.mUseTrackingProtection),
#ifdef DEBUG
mIsNotNull(aToCopy.mIsNotNull),
#endif
mOriginAttributes(aAttrs) {
}
LoadContext(dom::Element* aTopFrameElement, bool aIsContent,
bool aUsePrivateBrowsing, bool aUseRemoteTabs,
bool aUseRemoteSubframes, bool aUseTrackingProtection,
const OriginAttributes& aAttrs)
: mTopFrameElement(do_GetWeakReference(aTopFrameElement)),
mIsContent(aIsContent),
mUseRemoteTabs(aUseRemoteTabs),
mUseRemoteSubframes(aUseRemoteSubframes),
mUseTrackingProtection(aUseTrackingProtection),
#ifdef DEBUG
mIsNotNull(true),
#endif
mOriginAttributes(aAttrs) {
MOZ_DIAGNOSTIC_ASSERT(aUsePrivateBrowsing ==
(aAttrs.mPrivateBrowsingId > 0));
}
dom::Element* aTopFrameElement, OriginAttributes& aAttrs);
// Constructor taking reserved origin attributes.
explicit LoadContext(OriginAttributes& aAttrs)
: mTopFrameElement(nullptr),
mIsContent(false),
mUseRemoteTabs(false),
mUseRemoteSubframes(false),
mUseTrackingProtection(false),
#ifdef DEBUG
mIsNotNull(true),
#endif
mOriginAttributes(aAttrs) {
}
explicit LoadContext(OriginAttributes& aAttrs);
// Constructor for creating a LoadContext with a given browser flag.
explicit LoadContext(nsIPrincipal* aPrincipal,
nsILoadContext* aOptionalBase = nullptr);
private:
~LoadContext() {}
~LoadContext();
nsWeakPtr mTopFrameElement;
bool mIsContent;

Просмотреть файл

@ -867,7 +867,6 @@ nsresult ContentChild::ProvideWindowCommon(
*aReturn = nullptr;
UniquePtr<IPCTabContext> ipcContext;
TabId openerTabId = TabId(0);
nsAutoCString features(aFeatures);
nsAutoString name(aName);
@ -945,8 +944,7 @@ nsresult ContentChild::ProvideWindowCommon(
if (aTabOpener) {
PopupIPCTabContext context;
openerTabId = aTabOpener->GetTabId();
context.opener() = openerTabId;
context.openerChild() = aTabOpener;
ipcContext = MakeUnique<IPCTabContext>(context);
} else {
// It's possible to not have a BrowserChild opener in the case
@ -1015,11 +1013,6 @@ nsresult ContentChild::ProvideWindowCommon(
browsingContext, aChromeFlags,
/* aIsTopLevel */ true);
if (aTabOpener) {
MOZ_ASSERT(ipcContext->type() == IPCTabContext::TPopupIPCTabContext);
ipcContext->get_PopupIPCTabContext().opener() = aTabOpener;
}
if (IsShuttingDown()) {
return NS_ERROR_ABORT;
}
@ -2927,13 +2920,6 @@ void ContentChild::ShutdownInternal() {
: NS_LITERAL_CSTRING("SendFinishShutdown (failed)"));
}
PBrowserOrId ContentChild::GetBrowserOrId(BrowserChild* aBrowserChild) {
if (!aBrowserChild || this == aBrowserChild->Manager()) {
return PBrowserOrId(aBrowserChild);
}
return PBrowserOrId(aBrowserChild->GetTabId());
}
mozilla::ipc::IPCResult ContentChild::RecvUpdateWindow(
const uintptr_t& aChildId) {
#if defined(XP_WIN)

Просмотреть файл

@ -14,7 +14,6 @@
#include "mozilla/dom/BrowserBridgeChild.h"
#include "mozilla/dom/ProcessActor.h"
#include "mozilla/dom/JSProcessActorChild.h"
#include "mozilla/dom/PBrowserOrId.h"
#include "mozilla/dom/PContentChild.h"
#include "mozilla/dom/RemoteBrowser.h"
#include "mozilla/StaticPtr.h"
@ -76,13 +75,12 @@ class GetFilesHelperChild;
class TabContext;
enum class MediaControlKeysEvent : uint32_t;
class ContentChild final
: public PContentChild,
public nsIContentChild,
public nsIWindowProvider,
public mozilla::ipc::IShmemAllocator,
public mozilla::ipc::ChildToParentStreamActorManager,
public ProcessActor {
class ContentChild final : public PContentChild,
public nsIContentChild,
public nsIWindowProvider,
public mozilla::ipc::IShmemAllocator,
public mozilla::ipc::ChildToParentStreamActorManager,
public ProcessActor {
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
typedef mozilla::ipc::FileDescriptor FileDescriptor;
typedef mozilla::ipc::PFileDescriptorSetChild PFileDescriptorSetChild;
@ -507,8 +505,6 @@ class ContentChild final
void GetAvailableDictionaries(nsTArray<nsString>& aDictionaries);
PBrowserOrId GetBrowserOrId(BrowserChild* aBrowserChild);
PWebrtcGlobalChild* AllocPWebrtcGlobalChild();
bool DeallocPWebrtcGlobalChild(PWebrtcGlobalChild* aActor);

Просмотреть файл

@ -3169,14 +3169,8 @@ bool ContentParent::CanOpenBrowser(const IPCTabContext& aContext) {
if (aContext.type() == IPCTabContext::TPopupIPCTabContext) {
const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
if (popupContext.opener().type() != PBrowserOrId::TPBrowserParent) {
ASSERT_UNLESS_FUZZING(
"Unexpected PopupIPCTabContext type. Aborting AllocPBrowserParent.");
return false;
}
auto opener =
BrowserParent::GetFrom(popupContext.opener().get_PBrowserParent());
auto opener = BrowserParent::GetFrom(popupContext.openerParent());
if (!opener) {
ASSERT_UNLESS_FUZZING(
"Got null opener from child; aborting AllocPBrowserParent.");
@ -3222,8 +3216,7 @@ mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
// type PopupIPCTabContext, and that the opener BrowserParent is
// reachable.
const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
auto opener =
BrowserParent::GetFrom(popupContext.opener().get_PBrowserParent());
auto opener = BrowserParent::GetFrom(popupContext.openerParent());
openerTabId = opener->GetTabId();
openerCpId = opener->Manager()->ChildID();

Просмотреть файл

@ -29,7 +29,7 @@ using CSSRect from "Units.h";
using CSSSize from "Units.h";
using ScreenIntSize from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using nsSizeMode from "nsIWidgetListener.h";
using nsSizeMode from "mozilla/dom/TabMessageUtils.h";
using ScrollbarPreference from "mozilla/ScrollbarPreferences.h";
using hal::ScreenOrientation from "mozilla/HalScreenConfiguration.h";
using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h";

Просмотреть файл

@ -1,21 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et tw=80 ft=c: */
/* 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 protocol PBrowser;
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
namespace mozilla {
namespace dom {
union PBrowserOrId
{
nullable PBrowser;
TabId;
};
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -7,7 +7,6 @@
include "mozilla/dom/TabMessageUtils.h";
include protocol PBrowser;
include PBrowserOrId;
using UIStateChangeType from "nsPIDOMWindow.h";
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
@ -19,7 +18,7 @@ namespace dom {
// receives window.open().
struct PopupIPCTabContext
{
PBrowserOrId opener;
PBrowser opener;
uint64_t chromeOuterWindowID;
};

Просмотреть файл

@ -122,29 +122,14 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
const PopupIPCTabContext& ipcContext = aParams.get_PopupIPCTabContext();
TabContext* context;
if (ipcContext.opener().type() == PBrowserOrId::TPBrowserParent) {
context =
BrowserParent::GetFrom(ipcContext.opener().get_PBrowserParent());
if (!context) {
mInvalidReason =
"Child is-browser process tried to "
"open a null tab.";
return;
}
} else if (ipcContext.opener().type() == PBrowserOrId::TPBrowserChild) {
context =
static_cast<BrowserChild*>(ipcContext.opener().get_PBrowserChild());
} else if (ipcContext.opener().type() == PBrowserOrId::TTabId) {
// We should never get here because this PopupIPCTabContext is only
// used for allocating a new tab id, not for allocating a PBrowser.
mInvalidReason =
"Child process tried to open an tab without the opener "
"information.";
return;
if (ipcContext.openerParent()) {
context = BrowserParent::GetFrom(ipcContext.openerParent());
} else if (ipcContext.openerChild()) {
context = static_cast<BrowserChild*>(ipcContext.openerChild());
} else {
// This should be unreachable because PopupIPCTabContext::opener is not
// a nullable field.
mInvalidReason = "PopupIPCTabContext::opener was null (?!).";
mInvalidReason = "PopupIPCTabContext::opener was null.";
return;
}

Просмотреть файл

@ -160,7 +160,6 @@ PREPROCESSED_IPDL_SOURCES += [
IPDL_SOURCES += [
'DOMTypes.ipdlh',
'MemoryReportTypes.ipdlh',
'PBrowserOrId.ipdlh',
'PColorPicker.ipdl',
'PContentPermission.ipdlh',
'PContentPermissionRequest.ipdl',

Просмотреть файл

@ -127,15 +127,8 @@ bool NeckoChild::DeallocPAltDataOutputStreamChild(
return true;
}
already_AddRefed<PDocumentChannelChild> NeckoChild::AllocPDocumentChannelChild(
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
const DocumentChannelCreationArgs& args) {
MOZ_ASSERT_UNREACHABLE("AllocPDocumentChannelChild should not be called");
return nullptr;
}
PFTPChannelChild* NeckoChild::AllocPFTPChannelChild(
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
PBrowserChild* aBrowser, const SerializedLoadContext& aSerialized,
const FTPChannelCreationArgs& aOpenArgs) {
// We don't allocate here: see FTPChannelChild::AsyncOpen()
MOZ_CRASH("AllocPFTPChannelChild should not be called");
@ -166,7 +159,7 @@ bool NeckoChild::DeallocPCookieServiceChild(PCookieServiceChild* cs) {
}
PWebSocketChild* NeckoChild::AllocPWebSocketChild(
const PBrowserOrId& browser, const SerializedLoadContext& aSerialized,
PBrowserChild* browser, const SerializedLoadContext& aSerialized,
const uint32_t& aSerial) {
MOZ_ASSERT_UNREACHABLE("AllocPWebSocketChild should not be called");
return nullptr;

Просмотреть файл

@ -36,17 +36,13 @@ class NeckoChild : public PNeckoChild {
PHttpChannelChild* channel);
bool DeallocPAltDataOutputStreamChild(PAltDataOutputStreamChild* aActor);
already_AddRefed<PDocumentChannelChild> AllocPDocumentChannelChild(
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
const DocumentChannelCreationArgs& args);
PCookieServiceChild* AllocPCookieServiceChild();
bool DeallocPCookieServiceChild(PCookieServiceChild*);
PFTPChannelChild* AllocPFTPChannelChild(
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
PBrowserChild* aBrowser, const SerializedLoadContext& aSerialized,
const FTPChannelCreationArgs& aOpenArgs);
bool DeallocPFTPChannelChild(PFTPChannelChild*);
PWebSocketChild* AllocPWebSocketChild(const PBrowserOrId&,
PWebSocketChild* AllocPWebSocketChild(PBrowserChild*,
const SerializedLoadContext&,
const uint32_t&);
bool DeallocPWebSocketChild(PWebSocketChild*);

Просмотреть файл

@ -147,7 +147,7 @@ const char* NeckoParent::GetValidatedOriginAttributes(
}
const char* NeckoParent::CreateChannelLoadContext(
const PBrowserOrId& aBrowser, PContentParent* aContent,
PBrowserParent* aBrowser, PContentParent* aContent,
const SerializedLoadContext& aSerialized,
nsIPrincipal* aRequestingPrincipal, nsCOMPtr<nsILoadContext>& aResult) {
OriginAttributes attrs;
@ -162,24 +162,13 @@ const char* NeckoParent::CreateChannelLoadContext(
if (aSerialized.IsNotNull()) {
attrs.SyncAttributesWithPrivateBrowsing(
aSerialized.mOriginAttributes.mPrivateBrowsingId > 0);
switch (aBrowser.type()) {
case PBrowserOrId::TPBrowserParent: {
RefPtr<BrowserParent> browserParent =
BrowserParent::GetFrom(aBrowser.get_PBrowserParent());
dom::Element* topFrameElement = nullptr;
if (browserParent) {
topFrameElement = browserParent->GetOwnerElement();
}
aResult = new LoadContext(aSerialized, topFrameElement, attrs);
break;
}
case PBrowserOrId::TTabId: {
aResult = new LoadContext(aSerialized, nullptr, attrs);
break;
}
default:
MOZ_CRASH();
RefPtr<BrowserParent> browserParent = BrowserParent::GetFrom(aBrowser);
dom::Element* topFrameElement = nullptr;
if (browserParent) {
topFrameElement = browserParent->GetOwnerElement();
}
aResult = new LoadContext(aSerialized, topFrameElement, attrs);
}
return nullptr;
@ -191,7 +180,7 @@ void NeckoParent::ActorDestroy(ActorDestroyReason aWhy) {
}
already_AddRefed<PHttpChannelParent> NeckoParent::AllocPHttpChannelParent(
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
PBrowserParent* aBrowser, const SerializedLoadContext& aSerialized,
const HttpChannelCreationArgs& aOpenArgs) {
nsCOMPtr<nsIPrincipal> requestingPrincipal =
GetRequestingPrincipal(aOpenArgs);
@ -208,13 +197,13 @@ already_AddRefed<PHttpChannelParent> NeckoParent::AllocPHttpChannelParent(
}
PBOverrideStatus overrideStatus =
PBOverrideStatusFromLoadContext(aSerialized);
RefPtr<HttpChannelParent> p =
new HttpChannelParent(aBrowser, loadContext, overrideStatus);
RefPtr<HttpChannelParent> p = new HttpChannelParent(
BrowserParent::GetFrom(aBrowser), loadContext, overrideStatus);
return p.forget();
}
mozilla::ipc::IPCResult NeckoParent::RecvPHttpChannelConstructor(
PHttpChannelParent* aActor, const PBrowserOrId& aBrowser,
PHttpChannelParent* aActor, PBrowserParent* aBrowser,
const SerializedLoadContext& aSerialized,
const HttpChannelCreationArgs& aOpenArgs) {
HttpChannelParent* p = static_cast<HttpChannelParent*>(aActor);
@ -287,7 +276,7 @@ bool NeckoParent::DeallocPAltDataOutputStreamParent(
}
PFTPChannelParent* NeckoParent::AllocPFTPChannelParent(
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
PBrowserParent* aBrowser, const SerializedLoadContext& aSerialized,
const FTPChannelCreationArgs& aOpenArgs) {
nsCOMPtr<nsIPrincipal> requestingPrincipal =
GetRequestingPrincipal(aOpenArgs);
@ -304,8 +293,8 @@ PFTPChannelParent* NeckoParent::AllocPFTPChannelParent(
}
PBOverrideStatus overrideStatus =
PBOverrideStatusFromLoadContext(aSerialized);
FTPChannelParent* p =
new FTPChannelParent(aBrowser, loadContext, overrideStatus);
FTPChannelParent* p = new FTPChannelParent(BrowserParent::GetFrom(aBrowser),
loadContext, overrideStatus);
p->AddRef();
return p;
}
@ -317,7 +306,7 @@ bool NeckoParent::DeallocPFTPChannelParent(PFTPChannelParent* channel) {
}
mozilla::ipc::IPCResult NeckoParent::RecvPFTPChannelConstructor(
PFTPChannelParent* aActor, const PBrowserOrId& aBrowser,
PFTPChannelParent* aActor, PBrowserParent* aBrowser,
const SerializedLoadContext& aSerialized,
const FTPChannelCreationArgs& aOpenArgs) {
FTPChannelParent* p = static_cast<FTPChannelParent*>(aActor);
@ -362,7 +351,7 @@ bool NeckoParent::DeallocPCookieServiceParent(PCookieServiceParent* cs) {
}
PWebSocketParent* NeckoParent::AllocPWebSocketParent(
const PBrowserOrId& browser, const SerializedLoadContext& serialized,
PBrowserParent* browser, const SerializedLoadContext& serialized,
const uint32_t& aSerial) {
nsCOMPtr<nsILoadContext> loadContext;
const char* error = CreateChannelLoadContext(browser, Manager(), serialized,
@ -375,8 +364,7 @@ PWebSocketParent* NeckoParent::AllocPWebSocketParent(
return nullptr;
}
RefPtr<BrowserParent> browserParent =
BrowserParent::GetFrom(browser.get_PBrowserParent());
RefPtr<BrowserParent> browserParent = BrowserParent::GetFrom(browser);
PBOverrideStatus overrideStatus = PBOverrideStatusFromLoadContext(serialized);
WebSocketChannelParent* p = new WebSocketChannelParent(
browserParent, loadContext, overrideStatus, aSerial);

Просмотреть файл

@ -45,7 +45,7 @@ class NeckoParent : public PNeckoParent {
* Returns null if successful, or an error string if failed.
*/
[[nodiscard]] static const char* CreateChannelLoadContext(
const PBrowserOrId& aBrowser, PContentParent* aContent,
PBrowserParent* aBrowser, PContentParent* aContent,
const SerializedLoadContext& aSerialized,
nsIPrincipal* aRequestingPrincipal, nsCOMPtr<nsILoadContext>& aResult);
@ -90,10 +90,10 @@ class NeckoParent : public PNeckoParent {
bool mSocketProcessBridgeInited;
already_AddRefed<PHttpChannelParent> AllocPHttpChannelParent(
const PBrowserOrId&, const SerializedLoadContext&,
PBrowserParent*, const SerializedLoadContext&,
const HttpChannelCreationArgs& aOpenArgs);
virtual mozilla::ipc::IPCResult RecvPHttpChannelConstructor(
PHttpChannelParent* aActor, const PBrowserOrId& aBrowser,
PHttpChannelParent* aActor, PBrowserParent* aBrowser,
const SerializedLoadContext& aSerialized,
const HttpChannelCreationArgs& aOpenArgs) override;
@ -111,15 +111,15 @@ class NeckoParent : public PNeckoParent {
bool DeallocPCookieServiceParent(PCookieServiceParent*);
PFTPChannelParent* AllocPFTPChannelParent(
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
PBrowserParent* aBrowser, const SerializedLoadContext& aSerialized,
const FTPChannelCreationArgs& aOpenArgs);
virtual mozilla::ipc::IPCResult RecvPFTPChannelConstructor(
PFTPChannelParent* aActor, const PBrowserOrId& aBrowser,
PFTPChannelParent* aActor, PBrowserParent* aBrowser,
const SerializedLoadContext& aSerialized,
const FTPChannelCreationArgs& aOpenArgs) override;
bool DeallocPFTPChannelParent(PFTPChannelParent*);
PWebSocketParent* AllocPWebSocketParent(
const PBrowserOrId& browser, const SerializedLoadContext& aSerialized,
PBrowserParent* browser, const SerializedLoadContext& aSerialized,
const uint32_t& aSerial);
bool DeallocPWebSocketParent(PWebSocketParent*);
PTCPSocketParent* AllocPTCPSocketParent(const nsString& host,

Просмотреть файл

@ -32,7 +32,6 @@ include protocol PDocumentChannel;
include IPCStream;
include NeckoChannelParams;
include PBrowserOrId;
include protocol PAltDataOutputStream;
using mozilla::dom::MaybeDiscardedBrowsingContext from "mozilla/dom/BrowsingContext.h";
@ -74,13 +73,13 @@ parent:
async __delete__();
nested(inside_cpow) async PCookieService();
async PHttpChannel(PBrowserOrId browser,
async PHttpChannel(nullable PBrowser browser,
SerializedLoadContext loadContext,
HttpChannelCreationArgs args);
async PFTPChannel(PBrowserOrId browser, SerializedLoadContext loadContext,
async PFTPChannel(nullable PBrowser browser, SerializedLoadContext loadContext,
FTPChannelCreationArgs args);
async PWebSocket(PBrowserOrId browser, SerializedLoadContext loadContext,
async PWebSocket(nullable PBrowser browser, SerializedLoadContext loadContext,
uint32_t aSerialID);
async PTCPServerSocket(uint16_t localPort, uint16_t backlog, bool useArrayBuffers);
async PUDPSocket(nsIPrincipal principal, nsCString filter);

Просмотреть файл

@ -19,11 +19,11 @@ include protocol PAltSvcTransaction;
include MemoryReportTypes;
include NeckoChannelParams;
include PBrowserOrId;
include PrefsTypes;
include PSMIPCTypes;
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
using mozilla::Telemetry::HistogramAccumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::KeyedHistogramAccumulation from "mozilla/TelemetryComms.h";
using mozilla::Telemetry::ScalarAction from "mozilla/TelemetryComms.h";

Просмотреть файл

@ -36,7 +36,7 @@ using namespace mozilla::ipc;
namespace mozilla {
namespace net {
FTPChannelParent::FTPChannelParent(const PBrowserOrId& aIframeEmbedding,
FTPChannelParent::FTPChannelParent(dom::BrowserParent* aIframeEmbedding,
nsILoadContext* aLoadContext,
PBOverrideStatus aOverrideStatus)
: mIPCClosed(false),
@ -46,16 +46,12 @@ FTPChannelParent::FTPChannelParent(const PBrowserOrId& aIframeEmbedding,
mDivertingFromChild(false),
mDivertedOnStartRequest(false),
mSuspendedForDiversion(false),
mBrowserParent(aIframeEmbedding),
mUseUTF8(false) {
nsIProtocolHandler* handler;
CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp", &handler);
MOZ_ASSERT(handler, "no ftp handler");
if (aIframeEmbedding.type() == PBrowserOrId::TPBrowserParent) {
mBrowserParent =
static_cast<dom::BrowserParent*>(aIframeEmbedding.get_PBrowserParent());
}
mEventQ = new ChannelEventQueue(static_cast<nsIParentChannel*>(this));
}

Просмотреть файл

@ -22,7 +22,6 @@ namespace mozilla {
namespace dom {
class BrowserParent;
class PBrowserOrId;
} // namespace dom
namespace net {
@ -42,7 +41,7 @@ class FTPChannelParent final : public PFTPChannelParent,
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSICHANNELEVENTSINK
FTPChannelParent(const dom::PBrowserOrId& aIframeEmbedding,
FTPChannelParent(dom::BrowserParent* aIframeEmbedding,
nsILoadContext* aLoadContext,
PBOverrideStatus aOverrideStatus);

Просмотреть файл

@ -2059,10 +2059,8 @@ HttpChannelChild::ConnectParent(uint32_t registrarId) {
SetEventTarget();
HttpChannelConnectArgs connectArgs(registrarId, mShouldParentIntercept);
PBrowserOrId browser = static_cast<ContentChild*>(gNeckoChild->Manager())
->GetBrowserOrId(browserChild);
if (!gNeckoChild->SendPHttpChannelConstructor(
this, browser, IPC::SerializedLoadContext(this), connectArgs)) {
this, browserChild, IPC::SerializedLoadContext(this), connectArgs)) {
return NS_ERROR_FAILURE;
}
@ -2805,9 +2803,8 @@ nsresult HttpChannelChild::ContinueAsyncOpen() {
// target.
SetEventTarget();
PBrowserOrId browser = cc->GetBrowserOrId(browserChild);
if (!gNeckoChild->SendPHttpChannelConstructor(
this, browser, IPC::SerializedLoadContext(this), openArgs)) {
this, browserChild, IPC::SerializedLoadContext(this), openArgs)) {
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -63,11 +63,10 @@ using namespace mozilla::ipc;
namespace mozilla {
namespace net {
HttpChannelParent::HttpChannelParent(const PBrowserOrId& iframeEmbedding,
HttpChannelParent::HttpChannelParent(dom::BrowserParent* iframeEmbedding,
nsILoadContext* aLoadContext,
PBOverrideStatus aOverrideStatus)
: mLoadContext(aLoadContext),
mNestedFrameId(0),
mIPCClosed(false),
mPBOverride(aOverrideStatus),
mStatus(NS_OK),
@ -94,12 +93,7 @@ HttpChannelParent::HttpChannelParent(const PBrowserOrId& iframeEmbedding,
MOZ_ASSERT(gHttpHandler);
mHttpHandler = gHttpHandler;
if (iframeEmbedding.type() == PBrowserOrId::TPBrowserParent) {
mBrowserParent =
static_cast<dom::BrowserParent*>(iframeEmbedding.get_PBrowserParent());
} else {
mNestedFrameId = iframeEmbedding.get_TabId();
}
mBrowserParent = iframeEmbedding;
mSendWindowSize = gHttpHandler->SendWindowSize();
@ -2458,7 +2452,7 @@ NS_IMETHODIMP
HttpChannelParent::GetAuthPrompt(uint32_t aPromptReason, const nsIID& iid,
void** aResult) {
nsCOMPtr<nsIAuthPrompt2> prompt =
new NeckoParent::NestedFrameAuthPrompt(Manager(), mNestedFrameId);
new NeckoParent::NestedFrameAuthPrompt(Manager(), TabId(0));
prompt.forget(aResult);
return NS_OK;
}

Просмотреть файл

@ -37,7 +37,6 @@ namespace mozilla {
namespace dom {
class BrowserParent;
class PBrowserOrId;
} // namespace dom
namespace net {
@ -81,7 +80,7 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
NS_DECLARE_STATIC_IID_ACCESSOR(HTTP_CHANNEL_PARENT_IID)
HttpChannelParent(const dom::PBrowserOrId& iframeEmbedding,
HttpChannelParent(dom::BrowserParent* iframeEmbedding,
nsILoadContext* aLoadContext, PBOverrideStatus aStatus);
[[nodiscard]] bool Init(const HttpChannelCreationArgs& aOpenArgs);
@ -302,8 +301,6 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
MozPromiseHolder<GenericNonExclusivePromise> mPromise;
MozPromiseRequestHolder<GenericNonExclusivePromise> mRequest;
dom::TabId mNestedFrameId;
// To calculate the delay caused by the e10s back-pressure suspension
TimeStamp mResumedTimestamp;

Просмотреть файл

@ -7,7 +7,7 @@
include HeadlessWidgetTypes;
using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h";
using nsSizeMode from "nsIWidgetListener.h";
using nsSizeMode from "mozilla/dom/TabMessageUtils.h";
using nsTransparencyMode from "mozilla/widget/WidgetMessageUtils.h";
namespace mozilla {