tor-browser

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

commit 654afe9019ed9cffbb8577329d63577207a9eb31
parent 42f5c9811494b98304c4eea31baf2e0a56d26600
Author: Erik Nordin <enordin@mozilla.com>
Date:   Wed,  1 Oct 2025 16:07:09 +0000

Bug 1991224 - Update about:translations test event strings r=translations-reviewers,gregtatum

Updates all custom event strings for the `about:translations`
page to start with `AboutTranslationsTest` rather than just
`AboutTranslations`, especially so that they are not confused
with async messages that are critical to the page logic.

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

Diffstat:
Mtoolkit/components/translations/content/about-translations.mjs | 20++++++++++----------
Mtoolkit/components/translations/tests/browser/shared-head.js | 22++++++++++++----------
2 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/toolkit/components/translations/content/about-translations.mjs b/toolkit/components/translations/content/about-translations.mjs @@ -239,7 +239,7 @@ class AboutTranslations { if (orientationChanged) { document.dispatchEvent( - new CustomEvent("AboutTranslations:PageOrientationChanged", { + new CustomEvent("AboutTranslationsTest:PageOrientationChanged", { detail: { orientation: this.#pageOrientation }, }) ); @@ -555,7 +555,7 @@ class AboutTranslations { if (previousDetectedLanguage !== detectedLanguage) { document.dispatchEvent( - new CustomEvent("AboutTranslations:DetectedLanguageUpdated", { + new CustomEvent("AboutTranslationsTest:DetectedLanguageUpdated", { detail: { language: detectedLanguage }, }) ); @@ -653,7 +653,7 @@ class AboutTranslations { swapLanguagesButton.disabled = true; document.dispatchEvent( - new CustomEvent("AboutTranslations:SwapLanguagesButtonDisabled") + new CustomEvent("AboutTranslationsTest:SwapLanguagesButtonDisabled") ); } @@ -668,7 +668,7 @@ class AboutTranslations { swapLanguagesButton.disabled = false; document.dispatchEvent( - new CustomEvent("AboutTranslations:SwapLanguagesButtonEnabled") + new CustomEvent("AboutTranslationsTest:SwapLanguagesButtonEnabled") ); } @@ -782,7 +782,7 @@ class AboutTranslations { if (!value) { document.dispatchEvent( - new CustomEvent("AboutTranslations:ClearTargetText") + new CustomEvent("AboutTranslationsTest:ClearTargetText") ); } @@ -830,7 +830,7 @@ class AboutTranslations { ); document.dispatchEvent( - new CustomEvent("AboutTranslations:ShowTranslatingPlaceholder") + new CustomEvent("AboutTranslationsTest:ShowTranslatingPlaceholder") ); } @@ -927,7 +927,7 @@ class AboutTranslations { window.location.hash = params; document.dispatchEvent( - new CustomEvent("AboutTranslations:URLUpdatedFromUI", { + new CustomEvent("AboutTranslationsTest:URLUpdatedFromUI", { detail: { sourceLanguage, targetLanguage, sourceText }, }) ); @@ -1066,7 +1066,7 @@ class AboutTranslations { } document.dispatchEvent( - new CustomEvent("AboutTranslations:TranslationRequested", { + new CustomEvent("AboutTranslationsTest:TranslationRequested", { detail: { translationId }, }) ); @@ -1094,7 +1094,7 @@ class AboutTranslations { this.#setTargetText(translatedText); this.#updateSwapLanguagesButtonEnabledState(); document.dispatchEvent( - new CustomEvent("AboutTranslations:TranslationComplete", { + new CustomEvent("AboutTranslationsTest:TranslationComplete", { detail: { translationId }, }) ); @@ -1203,7 +1203,7 @@ class AboutTranslations { Math.abs(ratioDelta) > changeThreshold ) { document.dispatchEvent( - new CustomEvent("AboutTranslations:TextAreaHeightsChanged", { + new CustomEvent("AboutTranslationsTest:TextAreaHeightsChanged", { detail: { textAreaHeights: ratioDelta < 0 ? "decreased" : "increased", }, diff --git a/toolkit/components/translations/tests/browser/shared-head.js b/toolkit/components/translations/tests/browser/shared-head.js @@ -2773,7 +2773,7 @@ class AboutTranslationsTestUtils { * @type {string} */ static DetectedLanguageUpdated = - "AboutTranslations:DetectedLanguageUpdated"; + "AboutTranslationsTest:DetectedLanguageUpdated"; /** * Event fired when the swap-languages button becomes disabled. @@ -2781,7 +2781,7 @@ class AboutTranslationsTestUtils { * @type {string} */ static SwapLanguagesButtonDisabled = - "AboutTranslations:SwapLanguagesButtonDisabled"; + "AboutTranslationsTest:SwapLanguagesButtonDisabled"; /** * Event fired when the swap-languages button becomes enabled. @@ -2789,7 +2789,7 @@ class AboutTranslationsTestUtils { * @type {string} */ static SwapLanguagesButtonEnabled = - "AboutTranslations:SwapLanguagesButtonEnabled"; + "AboutTranslationsTest:SwapLanguagesButtonEnabled"; /** * Event fired when the translating placeholder message is shown. @@ -2797,49 +2797,51 @@ class AboutTranslationsTestUtils { * @type {string} */ static ShowTranslatingPlaceholder = - "AboutTranslations:ShowTranslatingPlaceholder"; + "AboutTranslationsTest:ShowTranslatingPlaceholder"; /** * Event fired after the URL has been updated from UI interactions. * * @type {string} */ - static URLUpdatedFromUI = "AboutTranslations:URLUpdatedFromUI"; + static URLUpdatedFromUI = "AboutTranslationsTest:URLUpdatedFromUI"; /** * Event fired when a translation is requested. * * @type {string} */ - static TranslationRequested = "AboutTranslations:TranslationRequested"; + static TranslationRequested = "AboutTranslationsTest:TranslationRequested"; /** * Event fired when a translation completes. * * @type {string} */ - static TranslationComplete = "AboutTranslations:TranslationComplete"; + static TranslationComplete = "AboutTranslationsTest:TranslationComplete"; /** * Event fired when the page layout changes. * * @type {string} */ - static PageOrientationChanged = "AboutTranslations:PageOrientationChanged"; + static PageOrientationChanged = + "AboutTranslationsTest:PageOrientationChanged"; /** * Event fired when the source/target textarea heights change. * * @type {string} */ - static TextAreaHeightsChanged = "AboutTranslations:TextAreaHeightsChanged"; + static TextAreaHeightsChanged = + "AboutTranslationsTest:TextAreaHeightsChanged"; /** * Event fired when the target text is cleared programmatically. * * @type {string} */ - static ClearTargetText = "AboutTranslations:ClearTargetText"; + static ClearTargetText = "AboutTranslationsTest:ClearTargetText"; }; /**