henry pushed to branch tor-browser-153.0esr-16.0-1 at The Tor Project / Applications / Tor Browser

Commits:

3 changed files:

Changes:

  • toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs
    ... ... @@ -15,8 +15,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
    15 15
         "moz-src:///toolkit/components/tor-launcher/TorProviderBuilder.sys.mjs",
    
    16 16
     });
    
    17 17
     
    
    18
    -const kPropBundleURI = "chrome://torbutton/locale/torlauncher.properties";
    
    19
    -const kPropNamePrefix = "torlauncher.";
    
    20 18
     const kIPCDirPrefName = "extensions.torlauncher.tmp_ipc_dir";
    
    21 19
     
    
    22 20
     /**
    
    ... ... @@ -374,86 +372,6 @@ export const TorLauncherUtil = {
    374 372
         return !re.test(path);
    
    375 373
       },
    
    376 374
     
    
    377
    -  // Returns true if user confirms; false if not.
    
    378
    -  showConfirm(aParentWindow, aMsg, aDefaultButtonLabel, aCancelButtonLabel) {
    
    379
    -    if (!aParentWindow) {
    
    380
    -      aParentWindow = Services.wm.getMostRecentWindow("navigator:browser");
    
    381
    -    }
    
    382
    -
    
    383
    -    const ps = Services.prompt;
    
    384
    -    const title = this.getLocalizedString("error_title");
    
    385
    -    const btnFlags =
    
    386
    -      ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING +
    
    387
    -      ps.BUTTON_POS_0_DEFAULT +
    
    388
    -      ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING;
    
    389
    -
    
    390
    -    const notUsed = { value: false };
    
    391
    -    const btnIndex = ps.confirmEx(
    
    392
    -      aParentWindow,
    
    393
    -      title,
    
    394
    -      aMsg,
    
    395
    -      btnFlags,
    
    396
    -      aDefaultButtonLabel,
    
    397
    -      aCancelButtonLabel,
    
    398
    -      null,
    
    399
    -      null,
    
    400
    -      notUsed
    
    401
    -    );
    
    402
    -    return btnIndex === 0;
    
    403
    -  },
    
    404
    -
    
    405
    -  /**
    
    406
    -   * Ask the user whether they desire to restart tor.
    
    407
    -   *
    
    408
    -   * @param {boolean} initError If we could connect to the control port at
    
    409
    -   * least once and we are showing this prompt because the tor process exited
    
    410
    -   * suddenly, we will display a different message
    
    411
    -   * @returns {boolean} true if the user asked to restart tor
    
    412
    -   */
    
    413
    -  showRestartPrompt(initError) {
    
    414
    -    let s;
    
    415
    -    if (initError) {
    
    416
    -      const key = "tor_exited_during_startup";
    
    417
    -      s = this.getLocalizedString(key);
    
    418
    -    } else {
    
    419
    -      // tor exited suddenly, so configuration should be okay
    
    420
    -      s =
    
    421
    -        this.getLocalizedString("tor_exited") +
    
    422
    -        "\n\n" +
    
    423
    -        this.getLocalizedString("tor_exited2");
    
    424
    -    }
    
    425
    -    const defaultBtnLabel = this.getLocalizedString("restart_tor");
    
    426
    -    let cancelBtnLabel = "OK";
    
    427
    -    try {
    
    428
    -      const kSysBundleURI = "chrome://global/locale/commonDialogs.properties";
    
    429
    -      const sysBundle = Services.strings.createBundle(kSysBundleURI);
    
    430
    -      cancelBtnLabel = sysBundle.GetStringFromName(cancelBtnLabel);
    
    431
    -    } catch (e) {
    
    432
    -      console.warn("Could not localize the cancel button", e);
    
    433
    -    }
    
    434
    -    return this.showConfirm(null, s, defaultBtnLabel, cancelBtnLabel);
    
    435
    -  },
    
    436
    -
    
    437
    -  _stringBundle: null,
    
    438
    -
    
    439
    -  // Localized Strings
    
    440
    -  // TODO: Switch to fluent also these ones.
    
    441
    -
    
    442
    -  // "torlauncher." is prepended to aStringName.
    
    443
    -  getLocalizedString(aStringName) {
    
    444
    -    if (!aStringName) {
    
    445
    -      return aStringName;
    
    446
    -    }
    
    447
    -    if (!this._stringBundle) {
    
    448
    -      this._stringBundle = Services.strings.createBundle(kPropBundleURI);
    
    449
    -    }
    
    450
    -    try {
    
    451
    -      const key = kPropNamePrefix + aStringName;
    
    452
    -      return this._stringBundle.GetStringFromName(key);
    
    453
    -    } catch (e) {}
    
    454
    -    return aStringName;
    
    455
    -  },
    
    456
    -
    
    457 375
       /**
    
    458 376
        * Determine what kind of SOCKS port has been requested for this session or
    
    459 377
        * the browser has been configured for.
    

  • toolkit/components/tor-launcher/TorProviderBuilder.sys.mjs
    ... ... @@ -4,8 +4,6 @@
    4 4
     
    
    5 5
     const lazy = {};
    
    6 6
     ChromeUtils.defineESModuleGetters(lazy, {
    
    7
    -  TorLauncherUtil:
    
    8
    -    "moz-src:///toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs",
    
    9 7
       TorProvider: "moz-src:///toolkit/components/tor-launcher/TorProvider.sys.mjs",
    
    10 8
       TorProviderMock:
    
    11 9
         "moz-src:///toolkit/components/tor-launcher/TorProviderMock.sys.mjs",
    
    ... ... @@ -279,8 +277,6 @@ export class TorProviderBuilder {
    279 277
           TorProviderTopics.ProviderStateChanged,
    
    280 278
           provider.state
    
    281 279
         );
    
    282
    -
    
    283
    -    this.#promptProviderState(false);
    
    284 280
       }
    
    285 281
     
    
    286 282
       /**
    
    ... ... @@ -400,85 +396,6 @@ export class TorProviderBuilder {
    400 396
         this.#replaceProvider();
    
    401 397
       }
    
    402 398
     
    
    403
    -  // TODO: Remove firstWindowLoaded, #uiReady, #prompting, #promptProviderState
    
    404
    -  // and use TorConnect instead. tor-browser#43570.
    
    405
    -  /**
    
    406
    -   * Check if the provider has been succesfully initialized when the first
    
    407
    -   * browser window is shown.
    
    408
    -   * This is a workaround we need because ideally we would like the tor process
    
    409
    -   * to start as soon as possible, to avoid delays in the about:torconnect page,
    
    410
    -   * but we should modify TorConnect and about:torconnect to handle this case
    
    411
    -   * there with a better UX.
    
    412
    -   */
    
    413
    -  static firstWindowLoaded() {
    
    414
    -    this.#promptProviderState(true);
    
    415
    -  }
    
    416
    -
    
    417
    -  /**
    
    418
    -   * Tell whether the browser UI is ready.
    
    419
    -   * We ignore any errors until it is because we cannot show them.
    
    420
    -   *
    
    421
    -   * @type {boolean}
    
    422
    -   */
    
    423
    -  static #uiReady = false;
    
    424
    -
    
    425
    -  /**
    
    426
    -   * Whether we are prompting the user for a restart of the provider.
    
    427
    -   *
    
    428
    -   * @type {boolean}
    
    429
    -   */
    
    430
    -  static #prompting = false;
    
    431
    -
    
    432
    -  /**
    
    433
    -   * Prompt the user to restart the provider, if this is necessary.
    
    434
    -   *
    
    435
    -   * @param {boolean} uiReady - Whether this is being called for the first time
    
    436
    -   *   when the UI is ready.
    
    437
    -   */
    
    438
    -  static async #promptProviderState(uiReady) {
    
    439
    -    if (uiReady) {
    
    440
    -      this.#uiReady = true;
    
    441
    -    }
    
    442
    -    if (this.#providerData.provider.state === TorProviderState.Running) {
    
    443
    -      // Nothing to wait for.
    
    444
    -      return;
    
    445
    -    }
    
    446
    -    if (!this.#uiReady) {
    
    447
    -      lazy.logger.warn(
    
    448
    -        "Seen exit, but not doing anything because the UI is not ready yet."
    
    449
    -      );
    
    450
    -      return;
    
    451
    -    }
    
    452
    -    if (this.#prompting) {
    
    453
    -      // Already prompting, so don't duplicate.
    
    454
    -      return;
    
    455
    -    }
    
    456
    -
    
    457
    -    this.#prompting = true;
    
    458
    -    let waitForInit = uiReady;
    
    459
    -    let retry = true;
    
    460
    -    try {
    
    461
    -      while (retry) {
    
    462
    -        if (waitForInit) {
    
    463
    -          try {
    
    464
    -            await this.#providerData.initPromise;
    
    465
    -          } catch {}
    
    466
    -        }
    
    467
    -        if (
    
    468
    -          this.#providerData.provider.state === TorProviderState.Stopped &&
    
    469
    -          lazy.TorLauncherUtil.showRestartPrompt(uiReady)
    
    470
    -        ) {
    
    471
    -          waitForInit = true;
    
    472
    -          this.replace();
    
    473
    -        } else {
    
    474
    -          retry = false;
    
    475
    -        }
    
    476
    -      }
    
    477
    -    } finally {
    
    478
    -      this.#prompting = false;
    
    479
    -    }
    
    480
    -  }
    
    481
    -
    
    482 399
       /**
    
    483 400
        * Return the provider chosen by the user.
    
    484 401
        * This function checks the TOR_PROVIDER environment variable and if it is a
    

  • toolkit/torbutton/chrome/locale/en-US/torlauncher.properties
    ... ... @@ -3,13 +3,6 @@
    3 3
     # License, v. 2.0. If a copy of the MPL was not distributed with this
    
    4 4
     # file, You can obtain one at http://mozilla.org/MPL/2.0/.
    
    5 5
     
    
    6
    -torlauncher.error_title=Tor Launcher
    
    7
    -torlauncher.tor_exited_during_startup=Tor exited during startup. This might be due to an error in your torrc file, a bug in Tor or another program on your system, or faulty hardware. Until you fix the underlying problem and restart Tor, Tor Browser will not start.
    
    8
    -torlauncher.tor_exited=Tor unexpectedly exited. This might be due to a bug in Tor itself, another program on your system, or faulty hardware. Until you restart Tor, Tor Browser will not be able to reach any websites. If the problem persists, please send a copy of your Tor Log to the support team.
    
    9
    -torlauncher.tor_exited2=Restarting Tor will not close your browser tabs.
    
    10
    -torlauncher.restart_tor=Restart Tor
    
    11
    -
    
    12
    -
    
    13 6
     # Translation note: %1$S is a bootstrap phase from torlauncher.bootstrapStatus,
    
    14 7
     # %2$S is the error from torlauncher.bootstrapWarning
    
    15 8
     torlauncher.tor_bootstrap_failed_details=%1$S failed (%2$S).