brizental pushed to branch tor-browser-140.3.0esr-15.0-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • toolkit/xre/nsAppRunner.cpp
    ... ... @@ -319,6 +319,8 @@ static nsIProfileLock* gProfileLock;
    319 319
     #if defined(MOZ_HAS_REMOTE)
    
    320 320
     MOZ_RUNINIT static RefPtr<nsRemoteService> gRemoteService;
    
    321 321
     MOZ_RUNINIT static RefPtr<nsStartupLock> gStartupLock;
    
    322
    +// tor-browser#43107: Disable remoting by default.
    
    323
    +bool gDisableRemoting = true;
    
    322 324
     #endif
    
    323 325
     
    
    324 326
     int gRestartArgc;
    
    ... ... @@ -2116,7 +2118,7 @@ nsresult ScopedXPCOMStartup::SetWindowCreator(nsINativeAppSupport* native) {
    2116 2118
     /* static */ already_AddRefed<nsIRemoteService> GetRemoteService() {
    
    2117 2119
       AssertIsOnMainThread();
    
    2118 2120
     
    
    2119
    -  if (!gRemoteService) {
    
    2121
    +  if (!gRemoteService && !gDisableRemoting) {
    
    2120 2122
         gRemoteService = new nsRemoteService();
    
    2121 2123
       }
    
    2122 2124
       nsCOMPtr<nsIRemoteService> remoteService = gRemoteService.get();
    
    ... ... @@ -2176,8 +2178,7 @@ static void DumpHelp() {
    2176 2178
           "  --origin-to-force-quic-on <origin>\n"
    
    2177 2179
           "                     Force to use QUIC for the specified origin.\n"
    
    2178 2180
     #ifdef MOZ_HAS_REMOTE
    
    2179
    -      "  --new-instance     Open new instance, not a new window in running "
    
    2180
    -      "instance.\n"
    
    2181
    +      "  --allow-remote     Accept and send remote commands.\n"
    
    2181 2182
     #endif
    
    2182 2183
           "  --safe-mode        Disables extensions and themes for this session.\n"
    
    2183 2184
     #ifdef MOZ_BLOCK_PROFILE_DOWNGRADE
    
    ... ... @@ -3847,9 +3848,6 @@ class XREMain {
    3847 3848
     
    
    3848 3849
       bool mStartOffline = false;
    
    3849 3850
       nsAutoCString mOriginToForceQUIC;
    
    3850
    -#if defined(MOZ_HAS_REMOTE)
    
    3851
    -  bool mDisableRemoteClient = false;
    
    3852
    -#endif
    
    3853 3851
     };
    
    3854 3852
     
    
    3855 3853
     #if defined(XP_UNIX) && !defined(ANDROID)
    
    ... ... @@ -4491,15 +4489,19 @@ int XREMain::XRE_mainInit(bool* aExitFlag) {
    4491 4489
       CheckArg("no-remote");
    
    4492 4490
     
    
    4493 4491
     #if defined(MOZ_HAS_REMOTE)
    
    4494
    -  // Handle the --new-instance command line arguments.
    
    4495
    -  ar = CheckArg("new-instance");
    
    4496
    -  if (ar == ARG_FOUND || EnvHasValue("MOZ_NEW_INSTANCE")) {
    
    4497
    -    mDisableRemoteClient = true;
    
    4492
    +  // tor-browser#43107: Drop the new-instance argument and environment
    
    4493
    +  // variables. They are confusing, because they kinda disable remoting when
    
    4494
    +  // it's already disabled in tor-browser.
    
    4495
    +  //
    
    4496
    +  // The user can still enable remoting if they want to, by adding the
    
    4497
    +  // allow-remote parameter to the command line.
    
    4498
    +  if (CheckArg("allow-remote") == ARG_FOUND) {
    
    4499
    +    gDisableRemoting = false;
    
    4498 4500
       }
    
    4499 4501
     #else
    
    4500 4502
       // These arguments do nothing in platforms with no remoting support but we
    
    4501 4503
       // should remove them from the command line anyway.
    
    4502
    -  CheckArg("new-instance");
    
    4504
    +  CheckArg("allow-remote");
    
    4503 4505
     #endif
    
    4504 4506
     
    
    4505 4507
       ar = CheckArg("offline");
    
    ... ... @@ -4868,7 +4870,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    4868 4870
     
    
    4869 4871
     #ifdef MOZ_HAS_REMOTE
    
    4870 4872
       if (gfxPlatform::IsHeadless()) {
    
    4871
    -    mDisableRemoteClient = true;
    
    4873
    +    gDisableRemoting = true;
    
    4872 4874
       }
    
    4873 4875
     #endif
    
    4874 4876
     
    
    ... ... @@ -4990,8 +4992,10 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    4990 4992
       }
    
    4991 4993
     #endif
    
    4992 4994
     #if defined(MOZ_HAS_REMOTE)
    
    4993
    -  // handle --remote now that xpcom is fired up
    
    4994
    -  gRemoteService = new nsRemoteService();
    
    4995
    +  if (!gDisableRemoting) {
    
    4996
    +    // handle --remote now that xpcom is fired up
    
    4997
    +    gRemoteService = new nsRemoteService();
    
    4998
    +  }
    
    4995 4999
       if (gRemoteService) {
    
    4996 5000
         gRemoteService->SetProgram(gAppData->remotingName);
    
    4997 5001
         gStartupLock = gRemoteService->LockStartup();
    
    ... ... @@ -5076,7 +5080,7 @@ int XREMain::XRE_mainStartup(bool* aExitFlag) {
    5076 5080
         if (NS_SUCCEEDED(rv)) {
    
    5077 5081
           gRemoteService->SetProfile(profilePath);
    
    5078 5082
     
    
    5079
    -      if (!mDisableRemoteClient) {
    
    5083
    +      if (!gDisableRemoting) {
    
    5080 5084
             // Try to remote the entire command line. If this fails, start up
    
    5081 5085
             // normally.
    
    5082 5086
     #  ifdef MOZ_WIDGET_GTK