Closed Bug 1899354 Opened 4 months ago Closed 4 months ago

SelectTranslationsPanel languageInfo cache is not correctly cleared between page loads

Categories

(Firefox :: Translations, defect, P3)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
128 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox126 --- unaffected
firefox127 --- unaffected
firefox128 --- verified
firefox129 --- verified

People

(Reporter: nordzilla, Assigned: nordzilla)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Description

Bug 1870368 patch D211230 introduced a cache to the SelectTranslationsPanel which includes the document's determined language tag.

This cached information is occasionally used in our fallback algorithm for when we detect that the selected text is in a language that is not yet supported by translations. In this case, we check the document's language tag, to see if the page's language is supported, and attempt to fall back to that in case the selected text was misidentified.

This cache was not being properly cleared between page loads, and it causes the panel to fall back to the document language of the previous page in this scenario, rather than the current page.


Steps to reproduce

  • Go to a page in a supported language, such as https://fi.wikipedia.org.
  • Select a paragraph of text on the page.
  • Open the SelectTranslationsPanel from the right-click context menu, and ensure that a valid translation completes in the document's language.
  • Next, navigate to https://ru.wikipedia.org and select the "Welcome to Wikipedia" at the top of the page: "Добро пожаловать в Википедию". Note, it is important to test with this exact string because our current language detector misidentifies this string as Serbian, which we currently do not support.
  • Open the SelectTranslationsPanel from the right-click context menu.

Expected Behavior
The SelectTranslationsPanel opens and translates from Russian, based on the current document's language tag.

Actual Behavior
The SelectTranslationsPanel opens and translates from the previous document's language (Finnish in this STR), based on the previous document's cached language tag.


Steps to implement

  • Ensure that the cache is properly cleared between navigating to other pages.

Tests to implement

  • Create a test case the reproduces the above situation, and ensure that the fallbacking is for the correct language.

This fixes an issue where the languageInfo cache,
which stores the document's determined language tag
was not correctly being cleared between page loads.

Set release status flags based on info from the regressing bug 1870368

Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a8aff969bda5 Ensure languageInfo cache is correctly cleared r=translations-reviewers,gregtatum
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
See Also: → 1903087

I have reproduced this issue in Nightly v128.0a1 from 2024-05-29 and verified the fix in Beta v128.0b5 and Nightly v129.0a1 from 2024-06-20.
Testing was performed in Windows 10, MacOS 11 and Ubuntu 22.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
OS: Unspecified → All
Hardware: Unspecified → Desktop
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: