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

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-140.8.0esr-15.0-1] fixup! TB 43107: Disable remoting by default



Title: GitLab

Pier Angelo Vendrame pushed to branch tor-browser-140.8.0esr-15.0-1 at The Tor Project / Applications / Tor Browser

Commits:

  • bc519e86
    by Pier Angelo Vendrame at 2026-03-11T18:24:59+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
    ... ... @@ -320,7 +320,7 @@ static nsIProfileLock* gProfileLock;
    320 320
     MOZ_RUNINIT static RefPtr<nsRemoteService> gRemoteService;
    
    321 321
     MOZ_RUNINIT static RefPtr<nsStartupLock> gStartupLock;
    
    322 322
     // tor-browser#43107: Disable remoting by default.
    
    323
    -bool gDisableRemoting = true;
    
    323
    +bool gEnableRemoting = false;
    
    324 324
     #endif
    
    325 325
     
    
    326 326
     int gRestartArgc;
    
    ... ... @@ -2118,8 +2118,8 @@ nsresult ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native) {
    2118 2118
     /* static */ already_AddRefed<nsIRemoteService> GetRemoteService() {
    
    2119 2119
       AssertIsOnMainThread();
    
    2120 2120
     
    
    2121
    -  if (!gRemoteService && !gDisableRemoting) {
    
    2122
    -    gRemoteService = new nsRemoteService();
    
    2121
    +  if (!gRemoteService) {
    
    2122
    +    gRemoteService = new nsRemoteService(gEnableRemoting);
    
    2123 2123
       }
    
    2124 2124
       nsCOMPtr<nsIRemoteService> remoteService = gRemoteService.get();
    
    2125 2125
       return remoteService.forget();
    
    ... ... @@ -4496,7 +4496,7 @@ int XREMain::XRE_mainInit(bool* aExitFlag) {
    4496 4496
       // The user can still enable remoting if they want to, by adding the
    
    4497 4497
       // allow-remote parameter to the command line.
    
    4498 4498
       if (CheckArg("allow-remote") == ARG_FOUND) {
    
    4499
    -    gDisableRemoting = false;
    
    4499
    +    gEnableRemoting = true;
    
    4500 4500
       }
    
    4501 4501
     #else
    
    4502 4502
       // These arguments do nothing in platforms with no remoting support but we
    
    ... ... @@ -4870,7 +4870,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    4870 4870
     
    
    4871 4871
     #ifdef MOZ_HAS_REMOTE
    
    4872 4872
       if (gfxPlatform::IsHeadless()) {
    
    4873
    -    gDisableRemoting = true;
    
    4873
    +    gEnableRemoting = false;
    
    4874 4874
       }
    
    4875 4875
     #endif
    
    4876 4876
     
    
    ... ... @@ -4992,10 +4992,8 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    4992 4992
       }
    
    4993 4993
     #endif
    
    4994 4994
     #if defined(MOZ_HAS_REMOTE)
    
    4995
    -  if (!gDisableRemoting) {
    
    4996
    -    // handle --remote now that xpcom is fired up
    
    4997
    -    gRemoteService = new nsRemoteService();
    
    4998
    -  }
    
    4995
    +  // handle --remote now that xpcom is fired up
    
    4996
    +  gRemoteService = new nsRemoteService(gEnableRemoting);
    
    4999 4997
       if (gRemoteService) {
    
    5000 4998
         gRemoteService->SetProgram(gAppData->remotingName);
    
    5001 4999
         gStartupLock = gRemoteService->LockStartup();
    
    ... ... @@ -5080,7 +5078,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    5080 5078
         if (NS_SUCCEEDED(rv)) {
    
    5081 5079
           gRemoteService->SetProfile(profilePath);
    
    5082 5080
     
    
    5083
    -      if (!gDisableRemoting) {
    
    5081
    +      if (gEnableRemoting) {
    
    5084 5082
             // Try to remote the entire command line. If this fails, start up
    
    5085 5083
             // normally.
    
    5086 5084
     #  ifdef MOZ_WIDGET_GTK
    

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