tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 15248b85cf6520bcc0b1eeec761a6d64810c973e
parent 9c093f906519ee4d92bdf59b626e7f449258a04e
Author: Andrew McCreight <continuation@gmail.com>
Date:   Thu, 30 Oct 2025 14:50:30 +0000

Bug 1997337 - Move GetRemoteType to JSActorManager. r=farre

Both subclasses define this, so just move it to the parent.
The ProcessActor one is const but the WindowGlobalActor isn't, so
I need to splash around some const to make it work.

Differential Revision: https://phabricator.services.mozilla.com/D270678

Diffstat:
Mdom/ipc/ProcessActor.h | 2--
Mdom/ipc/WindowGlobalActor.h | 1-
Mdom/ipc/WindowGlobalChild.cpp | 2+-
Mdom/ipc/WindowGlobalChild.h | 2+-
Mdom/ipc/WindowGlobalParent.cpp | 4++--
Mdom/ipc/WindowGlobalParent.h | 4++--
Mdom/ipc/jsactor/JSActorManager.h | 2++
7 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/dom/ipc/ProcessActor.h b/dom/ipc/ProcessActor.h @@ -26,8 +26,6 @@ class ProcessActor : public JSActorManager { already_AddRefed<JSActorProtocol> MatchingJSActorProtocol( JSActorService* aActorSvc, const nsACString& aName, ErrorResult& aRv) final; - - virtual const nsACString& GetRemoteType() const = 0; }; } // namespace dom diff --git a/dom/ipc/WindowGlobalActor.h b/dom/ipc/WindowGlobalActor.h @@ -41,7 +41,6 @@ class WindowGlobalActor : public JSActorManager { ErrorResult& aRv) final; virtual nsIURI* GetDocumentURI() = 0; - virtual const nsACString& GetRemoteType() = 0; virtual dom::BrowsingContext* BrowsingContext() = 0; static WindowGlobalInit BaseInitializer( diff --git a/dom/ipc/WindowGlobalChild.cpp b/dom/ipc/WindowGlobalChild.cpp @@ -661,7 +661,7 @@ void WindowGlobalChild::SetDocumentPrincipal( aNewDocumentStoragePrincipal); } -const nsACString& WindowGlobalChild::GetRemoteType() { +const nsACString& WindowGlobalChild::GetRemoteType() const { if (XRE_IsContentProcess()) { return ContentChild::GetSingleton()->GetRemoteType(); } diff --git a/dom/ipc/WindowGlobalChild.h b/dom/ipc/WindowGlobalChild.h @@ -153,7 +153,7 @@ class WindowGlobalChild final : public WindowGlobalActor, void BlockBFCacheFor(BFCacheStatus aStatus); protected: - const nsACString& GetRemoteType() override; + const nsACString& GetRemoteType() const override; already_AddRefed<JSActor> InitJSActor(JS::Handle<JSObject*> aMaybeActor, const nsACString& aName, diff --git a/dom/ipc/WindowGlobalParent.cpp b/dom/ipc/WindowGlobalParent.cpp @@ -258,7 +258,7 @@ already_AddRefed<WindowGlobalChild> WindowGlobalParent::GetChildActor() { return do_AddRef(static_cast<WindowGlobalChild*>(otherSide)); } -BrowserParent* WindowGlobalParent::GetBrowserParent() { +BrowserParent* WindowGlobalParent::GetBrowserParent() const { if (IsInProcess() || !CanSend()) { return nullptr; } @@ -570,7 +570,7 @@ IPCResult WindowGlobalParent::RecvRawMessage( return IPC_OK(); } -const nsACString& WindowGlobalParent::GetRemoteType() { +const nsACString& WindowGlobalParent::GetRemoteType() const { if (RefPtr<BrowserParent> browserParent = GetBrowserParent()) { return browserParent->Manager()->GetRemoteType(); } diff --git a/dom/ipc/WindowGlobalParent.h b/dom/ipc/WindowGlobalParent.h @@ -102,7 +102,7 @@ class WindowGlobalParent final : public WindowContext, // 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. - BrowserParent* GetBrowserParent(); + BrowserParent* GetBrowserParent() const; ContentParent* GetContentParent(); @@ -227,7 +227,7 @@ class WindowGlobalParent final : public WindowContext, nsITransportSecurityInfo* GetSecurityInfo() { return mSecurityInfo; } - const nsACString& GetRemoteType() override; + const nsACString& GetRemoteType() const override; void NotifySessionStoreUpdatesComplete(Element* aEmbedder); diff --git a/dom/ipc/jsactor/JSActorManager.h b/dom/ipc/jsactor/JSActorManager.h @@ -47,6 +47,8 @@ class JSActorManager : public nsISupports { UniquePtr<ipc::StructuredCloneData> aData, UniquePtr<ipc::StructuredCloneData> aStack); + virtual const nsACString& GetRemoteType() const = 0; + protected: /** * The actor is about to be destroyed so prevent it from sending any