Loading browser/base/content/browser.js +1 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ ChromeUtils.defineESModuleGetters(this, { ToolbarDropHandler: "moz-src:///browser/components/customizableui/ToolbarDropHandler.sys.mjs", ToolbarIconColor: "moz-src:///browser/themes/ToolbarIconColor.sys.mjs", TorUIUtils: "resource:///modules/TorUIUtils.sys.mjs", TranslationsParent: "resource://gre/actors/TranslationsParent.sys.mjs", UITour: "moz-src:///browser/components/uitour/UITour.sys.mjs", UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs", Loading browser/base/content/browser.js.globals +2 −1 Original line number Diff line number Diff line Loading @@ -237,5 +237,6 @@ "ProfilesDatastoreService", "gTrustPanelHandler", "ContentSharingUtils", "SecurityLevelButton" "SecurityLevelButton", "TorUIUtils" ] browser/modules/TorUIUtils.sys.mjs 0 → 100644 +26 −0 Original line number Diff line number Diff line /** * Common methods for tor UI components. */ export const TorUIUtils = { /** * Shorten the given address if it is an onion address. * * @param {string} address - The address to shorten. * * @returns {string} The shortened form of the address, or the address itself * if it was not shortened. */ shortenOnionAddress(address) { if ( // Only shorten ".onion" addresses. !address.endsWith(".onion") || // That are not "onion" aliases. address.endsWith(".tor.onion") || // And are long. address.length <= 21 ) { return address; } return `${address.slice(0, 6)}…${address.slice(-12)}`; }, }; browser/modules/moz.build +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ EXTRA_JS_MODULES += [ "SharingUtils.sys.mjs", "SiteDataManager.sys.mjs", "SitePermissions.sys.mjs", "TorUIUtils.sys.mjs", "TransientPrefs.sys.mjs", "UpdatePolicyEnforcer.sys.mjs", "URILoadingHelper.sys.mjs", Loading Loading
browser/base/content/browser.js +1 −0 Original line number Diff line number Diff line Loading @@ -105,6 +105,7 @@ ChromeUtils.defineESModuleGetters(this, { ToolbarDropHandler: "moz-src:///browser/components/customizableui/ToolbarDropHandler.sys.mjs", ToolbarIconColor: "moz-src:///browser/themes/ToolbarIconColor.sys.mjs", TorUIUtils: "resource:///modules/TorUIUtils.sys.mjs", TranslationsParent: "resource://gre/actors/TranslationsParent.sys.mjs", UITour: "moz-src:///browser/components/uitour/UITour.sys.mjs", UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs", Loading
browser/base/content/browser.js.globals +2 −1 Original line number Diff line number Diff line Loading @@ -237,5 +237,6 @@ "ProfilesDatastoreService", "gTrustPanelHandler", "ContentSharingUtils", "SecurityLevelButton" "SecurityLevelButton", "TorUIUtils" ]
browser/modules/TorUIUtils.sys.mjs 0 → 100644 +26 −0 Original line number Diff line number Diff line /** * Common methods for tor UI components. */ export const TorUIUtils = { /** * Shorten the given address if it is an onion address. * * @param {string} address - The address to shorten. * * @returns {string} The shortened form of the address, or the address itself * if it was not shortened. */ shortenOnionAddress(address) { if ( // Only shorten ".onion" addresses. !address.endsWith(".onion") || // That are not "onion" aliases. address.endsWith(".tor.onion") || // And are long. address.length <= 21 ) { return address; } return `${address.slice(0, 6)}…${address.slice(-12)}`; }, };
browser/modules/moz.build +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ EXTRA_JS_MODULES += [ "SharingUtils.sys.mjs", "SiteDataManager.sys.mjs", "SitePermissions.sys.mjs", "TorUIUtils.sys.mjs", "TransientPrefs.sys.mjs", "UpdatePolicyEnforcer.sys.mjs", "URILoadingHelper.sys.mjs", Loading