tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 71b1ae67929f7ed52743d43417540e85b7751c1f
parent 8c79baf4544dc2ab199cf28060341224041c7802
Author: Erik Nordin <enordin@mozilla.com>
Date:   Sat, 18 Oct 2025 02:16:50 +0000

Bug 1967758 - Enable Translations LangId in CI r=translations-reviewers,gregtatum

This patch enables everything related to Translations
in CI, except for auto-offering the Full-Page Translations
Panel. This means that language-detection logic will now run
in all CI jobs, including performance tests.

Differential Revision: https://phabricator.services.mozilla.com/D268280

Diffstat:
Mtoolkit/components/translations/actors/TranslationsParent.sys.mjs | 33+++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/toolkit/components/translations/actors/TranslationsParent.sys.mjs b/toolkit/components/translations/actors/TranslationsParent.sys.mjs @@ -728,19 +728,6 @@ export class TranslationsParent extends JSWindowActorParent { const { documentURI } = this.browsingContext.currentWindowGlobal; if ( - TranslationsParent.isInAutomation() && - !TranslationsParent.testAutomaticPopup - ) { - // Do not offer translations in automation, as many tests do not expect this - // behavior. - lazy.console.log( - "maybeOfferTranslations - Do not offer translations in automation.", - documentURI?.spec - ); - return; - } - - if ( !detectedLanguages.docLangTag || !detectedLanguages.userLangTag || !detectedLanguages.isDocLangTagSupported @@ -908,6 +895,19 @@ export class TranslationsParent extends JSWindowActorParent { // In Android, the active window is the active tab. isCurrentPage = documentURI?.spec === browser.documentURI?.spec; } + + if ( + TranslationsParent.isInAutomation() && + !TranslationsParent.testAutomaticPopup + ) { + // Do not show the panel in automation, as many tests do not expect this behavior. + lazy.console.log( + "maybeOfferTranslations - Do not show the translations panel in automation.", + documentURI?.spec + ); + return; + } + if (isCurrentPage) { lazy.console.log( "maybeOfferTranslations - Offering a translation", @@ -3473,13 +3473,6 @@ export class TranslationsParent extends JSWindowActorParent { * @returns {Promise<DetectionResult>} */ async queryIdentifyLanguage() { - if ( - TranslationsParent.isInAutomation() && - !TranslationsParent.#isTranslationsEngineMocked - ) { - // In automation assume English is the language, but don't be confident. - return { confident: false, language: "en", languages: [] }; - } return this.sendQuery("Translations:IdentifyLanguage").catch(error => { if (this.#isDestroyed) { // The actor was destroyed while this message was still being resolved.