morgan pushed to branch base-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • toolkit/components/search/SearchEngine.sys.mjs
    ... ... @@ -12,6 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
    12 12
       NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
    
    13 13
       SearchSettings: "resource://gre/modules/SearchSettings.sys.mjs",
    
    14 14
       SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs",
    
    15
    +  SecurityLevelPrefs: "resource://gre/modules/SecurityLevel.sys.mjs",
    
    15 16
       OpenSearchEngine: "resource://gre/modules/OpenSearchEngine.sys.mjs",
    
    16 17
     });
    
    17 18
     
    
    ... ... @@ -439,6 +440,26 @@ export class EngineURL {
    439 440
        */
    
    440 441
       getSubmission(searchTerms, queryCharset, purpose) {
    
    441 442
         var url = ParamSubstitution(this.template, searchTerms, queryCharset);
    
    443
    +
    
    444
    +    if (
    
    445
    +      lazy.SecurityLevelPrefs?.securityLevel === "safest" &&
    
    446
    +      this.type === lazy.SearchUtils.URL_TYPE.SEARCH
    
    447
    +    ) {
    
    448
    +      let host = this.templateHost;
    
    449
    +      try {
    
    450
    +        host = Services.eTLD.getBaseDomainFromHost(host);
    
    451
    +      } catch (ex) {
    
    452
    +        lazy.logConsole.warn("Failed to get a FPD", ex, host);
    
    453
    +      }
    
    454
    +      if (
    
    455
    +        host === "duckduckgo.com" ||
    
    456
    +        host ===
    
    457
    +          "duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion"
    
    458
    +      ) {
    
    459
    +        url += "html";
    
    460
    +      }
    
    461
    +    }
    
    462
    +
    
    442 463
         // Default to searchbar if the purpose is not provided
    
    443 464
         var requestPurpose = purpose || "searchbar";
    
    444 465