morgan pushed to branch tor-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser
Commits: cf748728 by Pier Angelo Vendrame at 2024-09-03T19:12:17+00:00 fixup! Bug 40925: Implemented the Security Level component
Bug 42617: Use DDG's plain HTML variant on Safest.
Between 115 and 128 we lost the engine parameter, so we are not given the search engine's ID anymore. So, switch to comparing the hostname instead.
- - - - -
1 changed file:
- toolkit/components/search/SearchEngine.sys.mjs
Changes:
===================================== toolkit/components/search/SearchEngine.sys.mjs ===================================== @@ -12,6 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, { NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", SearchSettings: "resource://gre/modules/SearchSettings.sys.mjs", SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs", + SecurityLevelPrefs: "resource://gre/modules/SecurityLevel.sys.mjs", OpenSearchEngine: "resource://gre/modules/OpenSearchEngine.sys.mjs", });
@@ -439,6 +440,26 @@ export class EngineURL { */ getSubmission(searchTerms, queryCharset, purpose) { var url = ParamSubstitution(this.template, searchTerms, queryCharset); + + if ( + lazy.SecurityLevelPrefs?.securityLevel === "safest" && + this.type === lazy.SearchUtils.URL_TYPE.SEARCH + ) { + let host = this.templateHost; + try { + host = Services.eTLD.getBaseDomainFromHost(host); + } catch (ex) { + lazy.logConsole.warn("Failed to get a FPD", ex, host); + } + if ( + host === "duckduckgo.com" || + host === + "duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion" + ) { + url += "html"; + } + } + // Default to searchbar if the purpose is not provided var requestPurpose = purpose || "searchbar";
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/cf748728...