Pier Angelo Vendrame pushed to branch tor-browser-149.0a1-16.0-2 at The Tor Project / Applications / Tor Browser

Commits:

2 changed files:

Changes:

  • toolkit/components/search/tests/xpcshell/test_base_browser.js
    ... ... @@ -10,6 +10,10 @@
    10 10
     
    
    11 11
     "use strict";
    
    12 12
     
    
    13
    +const { SearchService } = ChromeUtils.importESModule(
    
    14
    +  "moz-src:///toolkit/components/search/SearchService.sys.mjs"
    
    15
    +);
    
    16
    +
    
    13 17
     const expectedURLs = {
    
    14 18
       ddg: "https://duckduckgo.com/?q=test",
    
    15 19
       "ddg-noai": "https://noai.duckduckgo.com/?q=test",
    
    ... ... @@ -23,24 +27,23 @@ const expectedURLs = {
    23 27
     const defaultEngine = "ddg";
    
    24 28
     
    
    25 29
     add_setup(async function setup() {
    
    26
    -  await Services.search.init();
    
    30
    +  await SearchService.init();
    
    27 31
     });
    
    28 32
     
    
    29 33
     add_task(async function test_listEngines() {
    
    30
    -  const { engines } =
    
    31
    -    await Services.search.wrappedJSObject._fetchEngineSelectorEngines();
    
    34
    +  const { engines } = await SearchService._fetchEngineSelectorEngines();
    
    32 35
       const foundIdentifiers = engines.map(e => e.identifier);
    
    33 36
       Assert.deepEqual(foundIdentifiers, Object.keys(expectedURLs));
    
    34 37
     });
    
    35 38
     
    
    36 39
     add_task(async function test_default() {
    
    37 40
       Assert.equal(
    
    38
    -    (await Services.search.getDefault()).id,
    
    41
    +    (await SearchService.getDefault()).id,
    
    39 42
         defaultEngine,
    
    40 43
         `${defaultEngine} is our default search engine in normal mode.`
    
    41 44
       );
    
    42 45
       Assert.equal(
    
    43
    -    (await Services.search.getDefaultPrivate()).id,
    
    46
    +    (await SearchService.getDefaultPrivate()).id,
    
    44 47
         defaultEngine,
    
    45 48
         `${defaultEngine} is our default search engine in PBM.`
    
    46 49
       );
    
    ... ... @@ -48,7 +51,7 @@ add_task(async function test_default() {
    48 51
     
    
    49 52
     add_task(function test_checkSearchURLs() {
    
    50 53
       for (const [id, url] of Object.entries(expectedURLs)) {
    
    51
    -    const engine = Services.search.getEngineById(id);
    
    54
    +    const engine = SearchService.getEngineById(id);
    
    52 55
         const foundUrl = engine.getSubmission("test").uri.spec;
    
    53 56
         Assert.equal(foundUrl, url, `The URL of ${engine.name} is not altered.`);
    
    54 57
       }
    
    ... ... @@ -56,7 +59,7 @@ add_task(function test_checkSearchURLs() {
    56 59
     
    
    57 60
     add_task(async function test_iconsDoesNotFail() {
    
    58 61
       for (const id of Object.keys(expectedURLs)) {
    
    59
    -    const engine = Services.search.getEngineById(id);
    
    62
    +    const engine = SearchService.getEngineById(id);
    
    60 63
         // No need to assert anything, as in case of error this method should throw.
    
    61 64
         await engine.getIconURL();
    
    62 65
       }
    

  • toolkit/components/search/tests/xpcshell/test_security_level.js
    ... ... @@ -8,6 +8,10 @@
    8 8
     
    
    9 9
     "use strict";
    
    10 10
     
    
    11
    +const { SearchService } = ChromeUtils.importESModule(
    
    12
    +  "moz-src:///toolkit/components/search/SearchService.sys.mjs"
    
    13
    +);
    
    14
    +
    
    11 15
     const expectedURLs = {
    
    12 16
       ddg: "https://html.duckduckgo.com/html?q=test",
    
    13 17
       "ddg-onion":
    
    ... ... @@ -15,9 +19,9 @@ const expectedURLs = {
    15 19
     };
    
    16 20
     
    
    17 21
     add_task(async function test_securityLevel() {
    
    18
    -  await Services.search.init();
    
    22
    +  await SearchService.init();
    
    19 23
       for (const [id, url] of Object.entries(expectedURLs)) {
    
    20
    -    const engine = Services.search.getEngineById(id);
    
    24
    +    const engine = SearchService.getEngineById(id);
    
    21 25
         const foundUrl = engine.getSubmission("test").uri.spec;
    
    22 26
         Assert.equal(foundUrl, url, `${engine.name} is in HTML mode.`);
    
    23 27
       }