Pier Angelo Vendrame pushed to branch mullvad-browser-140.3.0esr-15.0-1 at The Tor Project / Applications / Mullvad Browser

Commits:

4 changed files:

Changes:

  • toolkit/components/search/SearchService.sys.mjs
    ... ... @@ -4,6 +4,7 @@
    4 4
     
    
    5 5
     /* eslint no-shadow: error, mozilla/no-aArgs: error */
    
    6 6
     
    
    7
    +import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
    
    7 8
     import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
    
    8 9
     
    
    9 10
     const lazy = {};
    
    ... ... @@ -1426,6 +1427,10 @@ export class SearchService {
    1426 1427
         // start listening straight away.
    
    1427 1428
         Services.obs.addObserver(this, lazy.Region.REGION_TOPIC);
    
    1428 1429
     
    
    1430
    +    this.#getIgnoreListAndSubscribe().catch(ex =>
    
    1431
    +      console.error(ex, "Search Service could not get the ignore list.")
    
    1432
    +    );
    
    1433
    +
    
    1429 1434
         this.#engineSelector = new lazy.SearchEngineSelector(
    
    1430 1435
           this.#handleConfigurationUpdated.bind(this)
    
    1431 1436
         );
    
    ... ... @@ -1568,7 +1573,6 @@ export class SearchService {
    1568 1573
        * handled via a sync listener.
    
    1569 1574
        *
    
    1570 1575
        */
    
    1571
    -  // eslint-disable-next-line no-unused-private-class-members
    
    1572 1576
       async #getIgnoreListAndSubscribe() {
    
    1573 1577
         let listener = this.#handleIgnoreListUpdated.bind(this);
    
    1574 1578
         const current = await lazy.IgnoreLists.getAndSubscribe(listener);
    
    ... ... @@ -1593,6 +1597,10 @@ export class SearchService {
    1593 1597
        *   The event in the format received from RemoteSettings.
    
    1594 1598
        */
    
    1595 1599
       async #handleIgnoreListUpdated(eventData) {
    
    1600
    +    if (AppConstants.BASE_BROWSER_VERSION) {
    
    1601
    +      return;
    
    1602
    +    }
    
    1603
    +
    
    1596 1604
         lazy.logConsole.debug("#handleIgnoreListUpdated");
    
    1597 1605
         const {
    
    1598 1606
           data: { current },
    

  • toolkit/components/search/tests/xpcshell/test_base_browser.js
    1
    +/* Any copyright is dedicated to the Public Domain.
    
    2
    + * http://creativecommons.org/publicdomain/zero/1.0/ */
    
    3
    +
    
    4
    +/**
    
    5
    + * This tests the SearchService to check our override of the remote settings is
    
    6
    + * working as expected.
    
    7
    + */
    
    8
    +
    
    9
    +"use strict";
    
    10
    +
    
    11
    +const expectedURLs = {
    
    12
    +  ddg: "https://duckduckgo.com/?q=test",
    
    13
    +  startpage: "https://www.startpage.com/sp/search?q=test",
    
    14
    +};
    
    15
    +const defaultEngine = "ddg";
    
    16
    +
    
    17
    +add_setup(async function setup() {
    
    18
    +  await Services.search.init();
    
    19
    +});
    
    20
    +
    
    21
    +add_task(async function test_listEngines() {
    
    22
    +  const { engines } =
    
    23
    +    await Services.search.wrappedJSObject._fetchEngineSelectorEngines();
    
    24
    +  const foundIdentifiers = engines.map(e => e.identifier);
    
    25
    +  Assert.deepEqual(foundIdentifiers, Object.keys(expectedURLs));
    
    26
    +});
    
    27
    +
    
    28
    +add_task(async function test_default() {
    
    29
    +  Assert.equal(
    
    30
    +    (await Services.search.getDefault()).id,
    
    31
    +    defaultEngine,
    
    32
    +    `${defaultEngine} is our default search engine in normal mode.`
    
    33
    +  );
    
    34
    +  Assert.equal(
    
    35
    +    (await Services.search.getDefaultPrivate()).id,
    
    36
    +    defaultEngine,
    
    37
    +    `${defaultEngine} is our default search engine in PBM.`
    
    38
    +  );
    
    39
    +});
    
    40
    +
    
    41
    +add_task(function test_checkSearchURLs() {
    
    42
    +  for (const [id, url] of Object.entries(expectedURLs)) {
    
    43
    +    const engine = Services.search.getEngineById(id);
    
    44
    +    const foundUrl = engine.getSubmission("test").uri.spec;
    
    45
    +    Assert.equal(foundUrl, url, `The URL of ${engine.name} is not altered.`);
    
    46
    +  }
    
    47
    +});

  • toolkit/components/search/tests/xpcshell/test_security_level.js
    1
    +/* Any copyright is dedicated to the Public Domain.
    
    2
    + * http://creativecommons.org/publicdomain/zero/1.0/ */
    
    3
    +
    
    4
    +/**
    
    5
    + * This tests that we use the HTML version of DuckDuckGo when in the safest
    
    6
    + * security level.
    
    7
    + */
    
    8
    +
    
    9
    +"use strict";
    
    10
    +
    
    11
    +const expectedURLs = {
    
    12
    +  ddg: "https://html.duckduckgo.com/html?q=test",
    
    13
    +};
    
    14
    +
    
    15
    +add_task(async function test_securityLevel() {
    
    16
    +  await Services.search.init();
    
    17
    +  for (const [id, url] of Object.entries(expectedURLs)) {
    
    18
    +    const engine = Services.search.getEngineById(id);
    
    19
    +    const foundUrl = engine.getSubmission("test").uri.spec;
    
    20
    +    Assert.equal(foundUrl, url, `${engine.name} is in HTML mode.`);
    
    21
    +  }
    
    22
    +});

  • toolkit/components/search/tests/xpcshell/xpcshell.toml
    ... ... @@ -38,6 +38,8 @@ tags = "remote-settings"
    38 38
     
    
    39 39
     ["test_async.js"]
    
    40 40
     
    
    41
    +["test_base_browser.js"]
    
    42
    +
    
    41 43
     ["test_configExpansion.js"]
    
    42 44
     support-files = [
    
    43 45
       "../../schema/search-config-v2-schema.json",
    
    ... ... @@ -199,6 +201,9 @@ support-files = [
    199 201
     
    
    200 202
     ["test_searchUrlDomain.js"]
    
    201 203
     
    
    204
    +["test_security_level.js"]
    
    205
    +prefs = ["browser.security_level.security_slider=1"]
    
    206
    +
    
    202 207
     ["test_selectedEngine.js"]
    
    203 208
     
    
    204 209
     ["test_sendSubmissionURL.js"]