[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-148.0a1-16.0-2] fixup! TB 43107: Disable remoting by default



Title: GitLab

Pier Angelo Vendrame pushed to branch tor-browser-148.0a1-16.0-2 at The Tor Project / Applications / Tor Browser

Commits:

  • 04a2b859
    by Pier Angelo Vendrame at 2026-03-04T15:10:53+01:00
    fixup! TB 43107: Disable remoting by default
    
    TB 44706: Fix a crash when creating new profiles.
    
    Rework the patch to disable remoting at runtime to allow using some of
    the service's functionalities, while still refusing to create any
    remoting server/client.
    

3 changed files:

Changes:

  • toolkit/components/remote/nsRemoteService.cpp
    ... ... @@ -53,7 +53,8 @@ nsStartupLock::~nsStartupLock() {
    53 53
     
    
    54 54
     NS_IMPL_ISUPPORTS(nsRemoteService, nsIObserver, nsIRemoteService)
    
    55 55
     
    
    56
    -nsRemoteService::nsRemoteService() : mProgram("mozilla") {
    
    56
    +nsRemoteService::nsRemoteService(bool aRemotingEnabled)
    
    57
    +    : mRemotingEnabled(aRemotingEnabled), mProgram("mozilla") {
    
    57 58
       ToLowerCase(mProgram);
    
    58 59
     }
    
    59 60
     
    
    ... ... @@ -194,6 +195,10 @@ nsresult nsRemoteService::SendCommandLine(const nsACString& aProfile,
    194 195
         return NS_ERROR_FAILURE;
    
    195 196
       }
    
    196 197
     
    
    198
    +  if (!mRemotingEnabled) {
    
    199
    +    return NS_ERROR_NOT_AVAILABLE;
    
    200
    +  }
    
    201
    +
    
    197 202
       UniquePtr<nsRemoteClient> client;
    
    198 203
     #ifdef MOZ_WIDGET_GTK
    
    199 204
     #  if defined(MOZ_ENABLE_DBUS)
    
    ... ... @@ -249,7 +254,7 @@ nsresult nsRemoteService::StartClient() {
    249 254
     }
    
    250 255
     
    
    251 256
     void nsRemoteService::StartupServer() {
    
    252
    -  if (mRemoteServer) {
    
    257
    +  if (mRemoteServer || !mRemotingEnabled) {
    
    253 258
         return;
    
    254 259
       }
    
    255 260
     
    

  • toolkit/components/remote/nsRemoteService.h
    ... ... @@ -39,7 +39,7 @@ class nsRemoteService final : public nsIObserver, public nsIRemoteService {
    39 39
       NS_DECL_NSIOBSERVER
    
    40 40
       NS_DECL_NSIREMOTESERVICE
    
    41 41
     
    
    42
    -  nsRemoteService();
    
    42
    +  nsRemoteService(bool aRemotingEnabled);
    
    43 43
       void SetProgram(const char* aProgram);
    
    44 44
       void SetProfile(nsACString& aProfile);
    
    45 45
     #ifdef MOZ_WIDGET_GTK
    
    ... ... @@ -91,6 +91,7 @@ class nsRemoteService final : public nsIObserver, public nsIRemoteService {
    91 91
       nsresult SendCommandLine(const nsACString& aProfile, size_t aArgc,
    
    92 92
                                const char** aArgv, bool aRaise);
    
    93 93
     
    
    94
    +  bool mRemotingEnabled;
    
    94 95
       mozilla::UniquePtr<nsRemoteServer> mRemoteServer;
    
    95 96
       nsCString mProgram;
    
    96 97
       nsCString mProfile;
    

  • toolkit/xre/nsAppRunner.cpp
    ... ... @@ -314,7 +314,7 @@ static nsIProfileLock* gProfileLock;
    314 314
     constinit static RefPtr<nsRemoteService> gRemoteService;
    
    315 315
     constinit static RefPtr<nsStartupLock> gStartupLock;
    
    316 316
     // tor-browser#43107: Disable remoting by default.
    
    317
    -bool gDisableRemoting = true;
    
    317
    +bool gEnableRemoting = false;
    
    318 318
     #endif
    
    319 319
     
    
    320 320
     int gRestartArgc;
    
    ... ... @@ -2095,8 +2095,8 @@ nsresult ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native) {
    2095 2095
     /* static */ already_AddRefed<nsIRemoteService> GetRemoteService() {
    
    2096 2096
       AssertIsOnMainThread();
    
    2097 2097
     
    
    2098
    -  if (!gRemoteService && !gDisableRemoting) {
    
    2099
    -    gRemoteService = new nsRemoteService();
    
    2098
    +  if (!gRemoteService) {
    
    2099
    +    gRemoteService = new nsRemoteService(gEnableRemoting);
    
    2100 2100
       }
    
    2101 2101
       nsCOMPtr<nsIRemoteService> remoteService = gRemoteService.get();
    
    2102 2102
       return remoteService.forget();
    
    ... ... @@ -4487,7 +4487,7 @@ int XREMain::XRE_mainInit(bool* aExitFlag) {
    4487 4487
       // The user can still enable remoting if they want to, by adding the
    
    4488 4488
       // allow-remote parameter to the command line.
    
    4489 4489
       if (CheckArg("allow-remote") == ARG_FOUND) {
    
    4490
    -    gDisableRemoting = false;
    
    4490
    +    gEnableRemoting = true;
    
    4491 4491
       }
    
    4492 4492
     #else
    
    4493 4493
       // These arguments do nothing in platforms with no remoting support but we
    
    ... ... @@ -4882,7 +4882,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    4882 4882
     
    
    4883 4883
     #ifdef MOZ_HAS_REMOTE
    
    4884 4884
       if (gfxPlatform::IsHeadless()) {
    
    4885
    -    gDisableRemoting = true;
    
    4885
    +    gEnableRemoting = false;
    
    4886 4886
       }
    
    4887 4887
     #endif
    
    4888 4888
     
    
    ... ... @@ -5004,10 +5004,8 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    5004 5004
       }
    
    5005 5005
     #endif
    
    5006 5006
     #if defined(MOZ_HAS_REMOTE)
    
    5007
    -  if (!gDisableRemoting) {
    
    5008
    -    // handle --remote now that xpcom is fired up
    
    5009
    -    gRemoteService = new nsRemoteService();
    
    5010
    -  }
    
    5007
    +  // handle --remote now that xpcom is fired up
    
    5008
    +  gRemoteService = new nsRemoteService(gEnableRemoting);
    
    5011 5009
       if (gRemoteService) {
    
    5012 5010
         gRemoteService->SetProgram(gAppData->remotingName);
    
    5013 5011
         gStartupLock = gRemoteService->LockStartup();
    
    ... ... @@ -5092,7 +5090,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    5092 5090
         if (NS_SUCCEEDED(rv)) {
    
    5093 5091
           gRemoteService->SetProfile(profilePath);
    
    5094 5092
     
    
    5095
    -      if (!gDisableRemoting) {
    
    5093
    +      if (gEnableRemoting) {
    
    5096 5094
             // Try to remote the entire command line. If this fails, start up
    
    5097 5095
             // normally.
    
    5098 5096
     #  ifdef MOZ_WIDGET_GTK
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx