Verified Commit da2d11fa authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

Bug 42247: Android helpers for the TorProvider

Bug 42655: Add a backend function for the "New circuit for this site"
functionality.
parent 6ca3c329
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2610,6 +2610,14 @@ public class GeckoSession {
    return mEventDispatcher.queryBundle("GeckoView:GetTorCircuit");
  }

  /**
   * Change the circuit for this session.
   */
  @UiThread
  public void newTorCircuit() {
    mEventDispatcher.dispatch("GeckoView:NewTorCircuit");
  }

  /**
   * Set this GeckoSession as active or inactive, which represents if the session is currently
   * visible or not. Setting a GeckoSession to inactive will significantly reduce its memory
+9 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ export class GeckoViewContent extends GeckoViewModule {
      "GeckoView:ZoomToInput",
      "GeckoView:IsPdfJs",
      "GeckoView:GetTorCircuit",
      "GeckoView:NewTorCircuit",
    ]);
  }

@@ -313,6 +314,9 @@ export class GeckoViewContent extends GeckoViewModule {
      case "GeckoView:GetTorCircuit":
        this._getTorCircuit(aCallback);
        break;
      case "GeckoView:NewTorCircuit":
        this._newTorCircuit(aCallback);
        break;
    }
  }

@@ -437,6 +441,11 @@ export class GeckoViewContent extends GeckoViewModule {
    }
  }

  _newTorCircuit(aCallback) {
    lazy.TorDomainIsolator.newCircuitForBrowser(this.browser);
    aCallback?.onSuccess();
  }

  async _containsFormData(aCallback) {
    aCallback.onSuccess(await this.actor.containsFormData());
  }