Pier Angelo Vendrame pushed to branch tor-browser-140.3.0esr-15.0-1 at The Tor Project / Applications / Tor Browser
Commits:
-
b17d862b
by Pier Angelo Vendrame at 2025-09-23T11:34:13+02:00
-
b1f4f5aa
by Pier Angelo Vendrame at 2025-09-23T11:34:16+02:00
-
030d4788
by Pier Angelo Vendrame at 2025-09-23T11:34:17+02:00
-
cb434512
by Pier Angelo Vendrame at 2025-09-23T11:34:18+02:00
-
2901ed30
by Pier Angelo Vendrame at 2025-09-23T11:34:19+02:00
5 changed files:
- toolkit/components/search/SearchService.sys.mjs
- toolkit/components/search/content/base-browser-search-engines.json
- + toolkit/components/search/tests/xpcshell/test_base_browser.js
- + toolkit/components/search/tests/xpcshell/test_security_level.js
- toolkit/components/search/tests/xpcshell/xpcshell.toml
Changes:
... | ... | @@ -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 },
|
... | ... | @@ -37,7 +37,7 @@ |
37 | 37 | },
|
38 | 38 | {
|
39 | 39 | "base": {
|
40 | - "aliases": ["startpage"],
|
|
40 | + "aliases": ["startpage", "sp"],
|
|
41 | 41 | "classification": "general",
|
42 | 42 | "name": "Startpage",
|
43 | 43 | "urls": {
|
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 | + "ddg-onion":
|
|
14 | + "https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/?q=test",
|
|
15 | + startpage: "https://www.startpage.com/sp/search?q=test",
|
|
16 | + "startpage-onion":
|
|
17 | + "http://startpagel6srwcjlue4zgq3zevrujfaow726kjytqbbjyrswwmjzcqd.onion/sp/search?q=test",
|
|
18 | + wikipedia: "https://en.wikipedia.org/wiki/Special:Search?search=test",
|
|
19 | +};
|
|
20 | +const defaultEngine = "ddg";
|
|
21 | + |
|
22 | +add_setup(async function setup() {
|
|
23 | + await Services.search.init();
|
|
24 | +});
|
|
25 | + |
|
26 | +add_task(async function test_listEngines() {
|
|
27 | + const { engines } =
|
|
28 | + await Services.search.wrappedJSObject._fetchEngineSelectorEngines();
|
|
29 | + const foundIdentifiers = engines.map(e => e.identifier);
|
|
30 | + Assert.deepEqual(foundIdentifiers, Object.keys(expectedURLs));
|
|
31 | +});
|
|
32 | + |
|
33 | +add_task(async function test_default() {
|
|
34 | + Assert.equal(
|
|
35 | + (await Services.search.getDefault()).id,
|
|
36 | + defaultEngine,
|
|
37 | + `${defaultEngine} is our default search engine in normal mode.`
|
|
38 | + );
|
|
39 | + Assert.equal(
|
|
40 | + (await Services.search.getDefaultPrivate()).id,
|
|
41 | + defaultEngine,
|
|
42 | + `${defaultEngine} is our default search engine in PBM.`
|
|
43 | + );
|
|
44 | +});
|
|
45 | + |
|
46 | +add_task(function test_checkSearchURLs() {
|
|
47 | + for (const [id, url] of Object.entries(expectedURLs)) {
|
|
48 | + const engine = Services.search.getEngineById(id);
|
|
49 | + const foundUrl = engine.getSubmission("test").uri.spec;
|
|
50 | + Assert.equal(foundUrl, url, `The URL of ${engine.name} is not altered.`);
|
|
51 | + }
|
|
52 | +}); |
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 | + "ddg-onion":
|
|
14 | + "https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/html?q=test",
|
|
15 | +};
|
|
16 | + |
|
17 | +add_task(async function test_securityLevel() {
|
|
18 | + await Services.search.init();
|
|
19 | + for (const [id, url] of Object.entries(expectedURLs)) {
|
|
20 | + const engine = Services.search.getEngineById(id);
|
|
21 | + const foundUrl = engine.getSubmission("test").uri.spec;
|
|
22 | + Assert.equal(foundUrl, url, `${engine.name} is in HTML mode.`);
|
|
23 | + }
|
|
24 | +}); |
... | ... | @@ -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"]
|