Loading toolkit/modules/Moat.sys.mjs +47 −1 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import { const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", Subprocess: "resource://gre/modules/Subprocess.sys.mjs", TorLauncherUtil: "resource://gre/modules/TorLauncherUtil.sys.mjs", TorProviderBuilder: "resource://gre/modules/TorProviderBuilder.sys.mjs", Loading Loading @@ -290,6 +291,48 @@ class MeekTransport { } } class MeekTransportAndroid { // These members are used by consumers to setup the proxy to do requests over // meek. They are passed to newProxyInfoWithAuth. proxyType = null; proxyAddress = null; proxyPort = 0; proxyUsername = null; proxyPassword = null; #id = 0; async init() { // ensure we haven't already init'd if (this.#id) { throw new Error("MeekTransport: Already initialized"); } const details = await lazy.EventDispatcher.instance.sendRequestForResult({ type: "GeckoView:Tor:StartMeek", }); this.#id = details.id; this.proxyType = "socks"; this.proxyAddress = details.address; this.proxyPort = details.port; [this.proxyUsername, this.proxyPassword] = makeMeekCredentials( this.proxyType ); } async uninit() { lazy.EventDispatcher.instance.sendRequest({ type: "GeckoView:Tor:StopMeek", id: this.#id, }); this.#id = 0; this.proxyType = null; this.proxyAddress = null; this.proxyPort = 0; this.proxyUsername = null; this.proxyPassword = null; } } // // Callback object with a cached promise for the returned Moat data // Loading Loading @@ -407,7 +450,10 @@ export class MoatRPC { throw new Error("MoatRPC: Already initialized"); } const meekTransport = new MeekTransport(); const meekTransport = Services.appinfo.OS === "Android" ? new MeekTransportAndroid() : new MeekTransport(); await meekTransport.init(); this.#meekTransport = meekTransport; this.#inited = true; Loading toolkit/modules/TorConnect.sys.mjs +3 −0 Original line number Diff line number Diff line Loading @@ -793,6 +793,9 @@ export const TorConnect = (() => { TorConnect._errorMessage = errorMessage; TorConnect._errorDetails = errorDetails; console.error( `[TorConnect] Entering error state (${errorMessage}, ${errorDetails})` ); Services.obs.notifyObservers( { message: errorMessage, details: errorDetails }, Loading Loading
toolkit/modules/Moat.sys.mjs +47 −1 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import { const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { EventDispatcher: "resource://gre/modules/Messaging.sys.mjs", Subprocess: "resource://gre/modules/Subprocess.sys.mjs", TorLauncherUtil: "resource://gre/modules/TorLauncherUtil.sys.mjs", TorProviderBuilder: "resource://gre/modules/TorProviderBuilder.sys.mjs", Loading Loading @@ -290,6 +291,48 @@ class MeekTransport { } } class MeekTransportAndroid { // These members are used by consumers to setup the proxy to do requests over // meek. They are passed to newProxyInfoWithAuth. proxyType = null; proxyAddress = null; proxyPort = 0; proxyUsername = null; proxyPassword = null; #id = 0; async init() { // ensure we haven't already init'd if (this.#id) { throw new Error("MeekTransport: Already initialized"); } const details = await lazy.EventDispatcher.instance.sendRequestForResult({ type: "GeckoView:Tor:StartMeek", }); this.#id = details.id; this.proxyType = "socks"; this.proxyAddress = details.address; this.proxyPort = details.port; [this.proxyUsername, this.proxyPassword] = makeMeekCredentials( this.proxyType ); } async uninit() { lazy.EventDispatcher.instance.sendRequest({ type: "GeckoView:Tor:StopMeek", id: this.#id, }); this.#id = 0; this.proxyType = null; this.proxyAddress = null; this.proxyPort = 0; this.proxyUsername = null; this.proxyPassword = null; } } // // Callback object with a cached promise for the returned Moat data // Loading Loading @@ -407,7 +450,10 @@ export class MoatRPC { throw new Error("MoatRPC: Already initialized"); } const meekTransport = new MeekTransport(); const meekTransport = Services.appinfo.OS === "Android" ? new MeekTransportAndroid() : new MeekTransport(); await meekTransport.init(); this.#meekTransport = meekTransport; this.#inited = true; Loading
toolkit/modules/TorConnect.sys.mjs +3 −0 Original line number Diff line number Diff line Loading @@ -793,6 +793,9 @@ export const TorConnect = (() => { TorConnect._errorMessage = errorMessage; TorConnect._errorDetails = errorDetails; console.error( `[TorConnect] Entering error state (${errorMessage}, ${errorDetails})` ); Services.obs.notifyObservers( { message: errorMessage, details: errorDetails }, Loading