Verified Commit 5911c55f authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser

Bug 42079: Support moving out of the TorConnectState.Bootsrapped state
for gTorConnectTitlebarStatus and gTorConnectUrlbarButton.
parent 0202ab19
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ var gTorConnectTitlebarStatus = {
        this.node.hidden = true;
        return;
      case TorConnectState.Bootstrapped:
        this._startHiding();
        textId = "titlebarStatusConnected";
        connected = true;
        break;
@@ -114,6 +113,14 @@ var gTorConnectTitlebarStatus = {
      );
      this.node.classList.toggle("tor-connect-status-connected", connected);
      this.connected = connected;
      if (connected) {
        this._startHiding();
      } else {
        // We can leave the connected state when we are no longer Bootstrapped
        // because the underlying tor process exited early and needs a
        // restart. In this case we want to re-show the status.
        this._stopHiding();
      }
    }
    this.node.classList.toggle(
      "tor-connect-status-potentially-blocked",
@@ -125,8 +132,23 @@ var gTorConnectTitlebarStatus = {
   * Mark the component to be hidden after some delay.
   */
  _startHiding() {
    setTimeout(() => {
    if (this._hidingTimeout) {
      // Already hiding.
      return;
    }
    this._hidingTimeout = setTimeout(() => {
      this.node.hidden = true;
    }, 5000);
  },

  /**
   * Re-show the component immediately.
   */
  _stopHiding() {
    if (this._hidingTimeout) {
      clearTimeout(this._hidingTimeout);
      this._hidingTimeout = 0;
    }
    this.node.hidden = false;
  },
};
+4 −4
Original line number Diff line number Diff line
@@ -112,10 +112,10 @@ var gTorConnectUrlbarButton = {
   * Callback for when the TorConnect state changes.
   */
  _torConnectStateChanged() {
    if (
      TorConnect.state === TorConnectState.Bootstrapped ||
      TorConnect.state === TorConnectState.Disabled
    ) {
    if (TorConnect.state === TorConnectState.Disabled) {
      // NOTE: We do not uninit early when we reach the
      // TorConnectState.Bootstrapped state because we can still leave the
      // Bootstrapped state if the tor process exists early and needs a restart.
      this.uninit();
      return;
    }