Pier Angelo Vendrame pushed to branch base-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser
Commits: bed52c3f by Dan Ballard at 2024-09-12T21:07:53+02:00 fixup! Firefox preference overrides.
Bug 43046: Disable emailTrackingBlocking in pbm
- - - - - 379a2960 by cypherpunks1 at 2024-09-12T21:08:09+02:00 fixup! Bug 40925: Implemented the Security Level component
Bug 43128: Use DuckDuckGo HTML on the Safest security level for Android
- - - - -
5 changed files:
- browser/app/profile/001-base-profile.js - mobile/android/android-components/components/feature/search/src/main/java/mozilla/components/feature/search/SearchUseCases.kt - mobile/android/android-components/components/feature/search/src/main/java/mozilla/components/feature/search/ext/SearchEngine.kt - mobile/android/android-components/components/feature/search/src/main/java/mozilla/components/feature/search/internal/SearchUrlBuilder.kt - mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/UseCases.kt
Changes:
===================================== browser/app/profile/001-base-profile.js ===================================== @@ -242,6 +242,7 @@ pref("privacy.donottrackheader.enabled", false); // (mullvad-browser#17) // Make sure there is no Tracking Protection active in Tor Browser, see: #17898. pref("privacy.trackingprotection.enabled", false); pref("privacy.trackingprotection.pbmode.enabled", false); +pref("privacy.trackingprotection.emailtracking.pbmode.enabled", false); pref("privacy.trackingprotection.annotate_channels", false); pref("privacy.trackingprotection.cryptomining.enabled", false); pref("privacy.trackingprotection.fingerprinting.enabled", false);
===================================== mobile/android/android-components/components/feature/search/src/main/java/mozilla/components/feature/search/SearchUseCases.kt ===================================== @@ -13,6 +13,8 @@ import mozilla.components.browser.state.state.SessionState import mozilla.components.browser.state.state.selectedOrDefaultSearchEngine import mozilla.components.browser.state.store.BrowserStore import mozilla.components.concept.engine.EngineSession +import mozilla.components.concept.engine.Settings +import mozilla.components.concept.engine.UnsupportedSettingException import mozilla.components.feature.search.ext.buildSearchUrl import mozilla.components.feature.session.SessionUseCases import mozilla.components.feature.tabs.TabsUseCases @@ -25,6 +27,7 @@ class SearchUseCases( store: BrowserStore, tabsUseCases: TabsUseCases, sessionUseCases: SessionUseCases, + settings: Settings? = null, ) { interface SearchUseCase { /** @@ -41,6 +44,7 @@ class SearchUseCases( private val store: BrowserStore, private val tabsUseCases: TabsUseCases, private val sessionUseCases: SessionUseCases, + private val settings: Settings? = null, ) : SearchUseCase { private val logger = Logger("DefaultSearchUseCase")
@@ -72,9 +76,15 @@ class SearchUseCases( flags: EngineSession.LoadUrlFlags = EngineSession.LoadUrlFlags.none(), additionalHeaders: Map<String, String>? = null, ) { + var securityLevel: Int + try { + securityLevel = settings?.torSecurityLevel ?: 0 + } catch (e: UnsupportedSettingException) { + securityLevel = 0 + } val searchUrl = searchEngine?.let { - searchEngine.buildSearchUrl(searchTerms) - } ?: store.state.search.selectedOrDefaultSearchEngine?.buildSearchUrl(searchTerms) + searchEngine.buildSearchUrl(searchTerms, securityLevel) + } ?: store.state.search.selectedOrDefaultSearchEngine?.buildSearchUrl(searchTerms, securityLevel)
if (searchUrl == null) { logger.warn("No default search engine available to perform search") @@ -124,6 +134,7 @@ class SearchUseCases( private val store: BrowserStore, private val tabsUseCases: TabsUseCases, private val isPrivate: Boolean, + private val settings: Settings? = null, ) : SearchUseCase { private val logger = Logger("NewTabSearchUseCase")
@@ -161,9 +172,15 @@ class SearchUseCases( flags: EngineSession.LoadUrlFlags = EngineSession.LoadUrlFlags.none(), additionalHeaders: Map<String, String>? = null, ) { + var securityLevel: Int + try { + securityLevel = settings?.torSecurityLevel ?: 0 + } catch (e: UnsupportedSettingException) { + securityLevel = 0 + } val searchUrl = searchEngine?.let { - searchEngine.buildSearchUrl(searchTerms) - } ?: store.state.search.selectedOrDefaultSearchEngine?.buildSearchUrl(searchTerms) + searchEngine.buildSearchUrl(searchTerms, securityLevel) + } ?: store.state.search.selectedOrDefaultSearchEngine?.buildSearchUrl(searchTerms, securityLevel)
if (searchUrl == null) { logger.warn("No default search engine available to perform search") @@ -310,15 +327,15 @@ class SearchUseCases( }
val defaultSearch: DefaultSearchUseCase by lazy { - DefaultSearchUseCase(store, tabsUseCases, sessionUseCases) + DefaultSearchUseCase(store, tabsUseCases, sessionUseCases, settings) }
val newTabSearch: NewTabSearchUseCase by lazy { - NewTabSearchUseCase(store, tabsUseCases, false) + NewTabSearchUseCase(store, tabsUseCases, false, settings) }
val newPrivateTabSearch: NewTabSearchUseCase by lazy { - NewTabSearchUseCase(store, tabsUseCases, true) + NewTabSearchUseCase(store, tabsUseCases, true, settings) }
val addSearchEngine: AddNewSearchEngineUseCase by lazy {
===================================== mobile/android/android-components/components/feature/search/src/main/java/mozilla/components/feature/search/ext/SearchEngine.kt ===================================== @@ -85,9 +85,9 @@ fun SearchEngine.buildSuggestionsURL(query: String): String? { /** * Builds a URL to search for the given search terms with this search engine. */ -fun SearchEngine.buildSearchUrl(searchTerm: String): String { +fun SearchEngine.buildSearchUrl(searchTerm: String, securityLevel: Int = 0): String { val builder = SearchUrlBuilder(this) - return builder.buildSearchUrl(searchTerm) + return builder.buildSearchUrl(searchTerm, securityLevel) }
/**
===================================== mobile/android/android-components/components/feature/search/src/main/java/mozilla/components/feature/search/internal/SearchUrlBuilder.kt ===================================== @@ -28,9 +28,12 @@ private const val OS_PARAM_OPTIONAL = "\{" + "(?:\w+:)?\w+?" + "\}" internal class SearchUrlBuilder( private val searchEngine: SearchEngine, ) { - fun buildSearchUrl(searchTerms: String): String { + fun buildSearchUrl(searchTerms: String, securityLevel: Int): String { // The parser should have put the best URL for this device at the beginning of the list. - val template = searchEngine.resultUrls[0] + var template = searchEngine.resultUrls[0] + if (securityLevel == 1 && (searchEngine.id == "ddg" || searchEngine.id == "ddg-onion")) { + template = template.replaceFirst("/?", "/html/?") + } return buildUrl(template, searchTerms) }
===================================== mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/UseCases.kt ===================================== @@ -73,6 +73,7 @@ class UseCases( store, tabsUseCases, sessionUseCases, + engine.settings, ) }
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/ec42f6f...
tbb-commits@lists.torproject.org