Loading browser/components/onionservices/content/authPrompt.js +2 −6 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { OnionAuthUtil: "chrome://browser/content/onionservices/authUtil.jsm", CommonUtils: "resource://services-common/utils.js", TorProtocolService: "resource://gre/modules/TorProtocolService.jsm", TorStrings: "resource:///modules/TorStrings.jsm", }); Loading Loading @@ -192,10 +193,6 @@ const OnionAuthPrompt = (function () { let controllerFailureMsg = TorStrings.onionServices.authPrompt.failedToSetKey; try { let { controller } = ChromeUtils.import( "resource://torbutton/modules/tor-control-port.js" ); let torController = await controller(); // ^(subdomain.)*onionserviceid.onion$ (case-insensitive) const onionServiceIdRegExp = /^(.*\.)*(?<onionServiceId>[a-z2-7]{56})\.onion$/i; Loading @@ -206,8 +203,7 @@ const OnionAuthPrompt = (function () { let checkboxElem = this._getCheckboxElement(); let isPermanent = checkboxElem && checkboxElem.checked; torController .onionAuthAdd(onionServiceId, base64key, isPermanent) TorProtocolService.onionAuthAdd(onionServiceId, base64key, isPermanent) .then(aResponse => { // Success! Reload the page. this._browser.sendMessageToActor( Loading browser/components/onionservices/content/savedKeysDialog.js +6 −9 Original line number Diff line number Diff line Loading @@ -10,8 +10,8 @@ ChromeUtils.defineModuleGetter( ChromeUtils.defineModuleGetter( this, "controller", "resource://torbutton/modules/tor-control-port.js" "TorProtocolService", "resource://gre/modules/TorProtocolService.jsm" ); var gOnionServicesSavedKeysDialog = { Loading Loading @@ -49,11 +49,9 @@ var gOnionServicesSavedKeysDialog = { const controllerFailureMsg = TorStrings.onionServices.authPreferences.failedToRemoveKey; try { const torController = await controller(); // Remove in reverse index order to avoid issues caused by index changes. for (let i = indexesToDelete.length - 1; i >= 0; --i) { await this._deleteOneKey(torController, indexesToDelete[i]); await this._deleteOneKey(indexesToDelete[i]); } } catch (e) { if (e.torMessage) { Loading Loading @@ -127,8 +125,7 @@ var gOnionServicesSavedKeysDialog = { try { this._tree.view = this; const torController = await controller(); const keyInfoList = await torController.onionAuthViewKeys(); const keyInfoList = await TorProtocolService.onionAuthViewKeys(); if (keyInfoList) { // Filter out temporary keys. this._keyInfoList = keyInfoList.filter(aKeyInfo => { Loading Loading @@ -165,9 +162,9 @@ var gOnionServicesSavedKeysDialog = { }, // This method may throw; callers should catch errors. async _deleteOneKey(aTorController, aIndex) { async _deleteOneKey(aIndex) { const keyInfoObj = this._keyInfoList[aIndex]; await aTorController.onionAuthRemove(keyInfoObj.hsAddress); await TorProtocolService.onionAuthRemove(keyInfoObj.hsAddress); this._tree.view.selection.clearRange(aIndex, aIndex); this._keyInfoList.splice(aIndex, 1); this._tree.rowCountChanged(aIndex + 1, -1); Loading Loading
browser/components/onionservices/content/authPrompt.js +2 −6 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { OnionAuthUtil: "chrome://browser/content/onionservices/authUtil.jsm", CommonUtils: "resource://services-common/utils.js", TorProtocolService: "resource://gre/modules/TorProtocolService.jsm", TorStrings: "resource:///modules/TorStrings.jsm", }); Loading Loading @@ -192,10 +193,6 @@ const OnionAuthPrompt = (function () { let controllerFailureMsg = TorStrings.onionServices.authPrompt.failedToSetKey; try { let { controller } = ChromeUtils.import( "resource://torbutton/modules/tor-control-port.js" ); let torController = await controller(); // ^(subdomain.)*onionserviceid.onion$ (case-insensitive) const onionServiceIdRegExp = /^(.*\.)*(?<onionServiceId>[a-z2-7]{56})\.onion$/i; Loading @@ -206,8 +203,7 @@ const OnionAuthPrompt = (function () { let checkboxElem = this._getCheckboxElement(); let isPermanent = checkboxElem && checkboxElem.checked; torController .onionAuthAdd(onionServiceId, base64key, isPermanent) TorProtocolService.onionAuthAdd(onionServiceId, base64key, isPermanent) .then(aResponse => { // Success! Reload the page. this._browser.sendMessageToActor( Loading
browser/components/onionservices/content/savedKeysDialog.js +6 −9 Original line number Diff line number Diff line Loading @@ -10,8 +10,8 @@ ChromeUtils.defineModuleGetter( ChromeUtils.defineModuleGetter( this, "controller", "resource://torbutton/modules/tor-control-port.js" "TorProtocolService", "resource://gre/modules/TorProtocolService.jsm" ); var gOnionServicesSavedKeysDialog = { Loading Loading @@ -49,11 +49,9 @@ var gOnionServicesSavedKeysDialog = { const controllerFailureMsg = TorStrings.onionServices.authPreferences.failedToRemoveKey; try { const torController = await controller(); // Remove in reverse index order to avoid issues caused by index changes. for (let i = indexesToDelete.length - 1; i >= 0; --i) { await this._deleteOneKey(torController, indexesToDelete[i]); await this._deleteOneKey(indexesToDelete[i]); } } catch (e) { if (e.torMessage) { Loading Loading @@ -127,8 +125,7 @@ var gOnionServicesSavedKeysDialog = { try { this._tree.view = this; const torController = await controller(); const keyInfoList = await torController.onionAuthViewKeys(); const keyInfoList = await TorProtocolService.onionAuthViewKeys(); if (keyInfoList) { // Filter out temporary keys. this._keyInfoList = keyInfoList.filter(aKeyInfo => { Loading Loading @@ -165,9 +162,9 @@ var gOnionServicesSavedKeysDialog = { }, // This method may throw; callers should catch errors. async _deleteOneKey(aTorController, aIndex) { async _deleteOneKey(aIndex) { const keyInfoObj = this._keyInfoList[aIndex]; await aTorController.onionAuthRemove(keyInfoObj.hsAddress); await TorProtocolService.onionAuthRemove(keyInfoObj.hsAddress); this._tree.view.selection.clearRange(aIndex, aIndex); this._keyInfoList.splice(aIndex, 1); this._tree.rowCountChanged(aIndex + 1, -1); Loading