Pier Angelo Vendrame pushed to branch tor-browser-115.1.0esr-13.0-1 at The Tor Project / Applications / Tor Browser

Commits:

1 changed file:

Changes:

  • toolkit/components/search/SearchService.sys.mjs
    ... ... @@ -2704,6 +2704,7 @@ export class SearchService {
    2704 2704
         };
    
    2705 2705
     
    
    2706 2706
         let engines = [];
    
    2707
    +    let revert = false;
    
    2707 2708
         for (let locale of locales) {
    
    2708 2709
           lazy.logConsole.debug(
    
    2709 2710
             "addEnginesFromExtension: installing:",
    
    ... ... @@ -2711,7 +2712,28 @@ export class SearchService {
    2711 2712
             ":",
    
    2712 2713
             locale
    
    2713 2714
           );
    
    2714
    -      engines.push(await installLocale(locale));
    
    2715
    +      try {
    
    2716
    +        engines.push(await installLocale(locale));
    
    2717
    +      } catch (err) {
    
    2718
    +        lazy.logConsole.error(
    
    2719
    +          `Could not install the search engine of ${extension.id}`,
    
    2720
    +          err
    
    2721
    +        );
    
    2722
    +        revert = true;
    
    2723
    +        break;
    
    2724
    +      }
    
    2725
    +    }
    
    2726
    +    if (revert) {
    
    2727
    +      for (let engine of engines) {
    
    2728
    +        try {
    
    2729
    +          this.removeEngine(engine);
    
    2730
    +        } catch (err) {
    
    2731
    +          lazy.logConsole.warn(
    
    2732
    +            "Failed to revert the addition of a search engine",
    
    2733
    +            err
    
    2734
    +          );
    
    2735
    +        }
    
    2736
    +      }
    
    2715 2737
         }
    
    2716 2738
         return engines;
    
    2717 2739
       }