Commit 5b194faf authored by clairehurst's avatar clairehurst 🌱
Browse files

fixup! TB 40933: Add tor-launcher functionality

Bug 43571: [Android] Add tor exit prompt

Specifically, this commit is a patch provided from
!2054 (comment 3446133)
parent 1efdc3dc
Loading
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -51,6 +51,11 @@ export class TorProcessAndroid {
   * it failed to start tor.
   */
  #startReject = null;
  /**
   * Tells whether we ever registered ourself as the listener to the various
   * process events.
   */
  #registeredListeners = false;

  onExit = () => {};

@@ -74,6 +79,7 @@ export class TorProcessAndroid {
      this,
      Object.values(TorIncomingEvents)
    );
    this.#registeredListeners = true;
    let config;
    try {
      config = await lazy.EventDispatcher.instance.sendRequestForResult(
@@ -103,10 +109,13 @@ export class TorProcessAndroid {
    });
    logger.debug("Sent the stop event.");
    this.#processHandle = null;
    if (this.#registeredListeners) {
      lazy.EventDispatcher.instance.unregisterListener(
        this,
        Object.values(TorIncomingEvents)
      );
      this.#registeredListeners = false;
    }
  }

  onEvent(event, data, _callback) {