Closed Bug 1903087 Opened 3 months ago Closed 3 months ago

SelectTranslationsPanel cached docLangTag is not correctly updated between panel opens

Categories

(Firefox :: Translations, defect, P2)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
129 Branch
Tracking Status
firefox128 --- verified
firefox129 --- verified

People

(Reporter: nordzilla, Assigned: nordzilla)

References

Details

Attachments

(2 files)

Description

In Bug 1899354 I attempted to fix an issue with the languageInfo cache not updating correctly between page loads, however I fixed only half the problem.

While investigating Bug 1903044 it became clear that the cache will need to be invalidated between each panel open, otherwise the incorrect document language tag will be reported to telemetry.


Steps to reproduce

  • Ensure that toolkit.telemetry.translations.logLevel is set to Debug.
  • Open the Browser Console and filter on TranslationsTelemetry.
  • Open a page in a new tab, e.g. https://fr.wikipedia.org.
  • Open a page in a different language in another tab, e.g. https://es.wikipedia.org.
  • Select text and open the SelectTranslationsPanel on the Spanish page.
  • Switch to the French-page tab.
  • Select text and open the SelectTranslationsPanel on the French page.

Expected Behavior

The docLangTag attribute for the onOpen event and onTranslate event shows fr for the French-page telemetry submission.

Actual Behavior

The docLangTag attribute for the onOpen event and onTranslate event shows es for the French-page telemetry submission, reading old the value from the cache.


Steps to implement

  • Ensure that the languageInfo cache is invalidated with each open of the panel.

Tests to implement

  • Write a telemetry test that ensures the correct document language tag is reported with multiple tabs open.

Ensures that the SelectTranslationsPanel languageInfo cache
is refreshed every time the panel would be opened. This prevents
a case where the incorrect (previous) document language tag
is reported to telemetry in some cases.

Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f96ac3918096 Refresh languageInfo cache on every panel open r=translations-reviewers,gregtatum
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch

Ensures that the SelectTranslationsPanel languageInfo cache
is refreshed every time the panel would be opened. This prevents
a case where the incorrect (previous) document language tag
is reported to telemetry in some cases.

Original Revision: https://phabricator.services.mozilla.com/D214011

Attachment #9408212 - Flags: approval-mozilla-beta?

beta Uplift Approval Request

  • User impact if declined: The Select Translations Panel will occasionally report the incorrect detected document language tag to telemetry
  • Code covered by automated testing: yes
  • Fix verified in Nightly: yes
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: STR are included in the bug description.
  • Risk associated with taking this patch: Very low
  • Explanation of risk level: This patch affects only the Select Translations Panel and is well covered by pre-existing and new automated tests
  • String changes made/needed: None
  • Is Android affected?: no
Flags: qe-verify+
Flags: in-testsuite+
Attachment #9408212 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

I can reproduce this issue in Nightly v129.0a1 from 2024-06-17 and verify the fix in Nightly v129.0a1 from 2024-06-20 and Beta v128.0b5. The docLangTag shows the expected language when using the steps in comment 0. Tested in Windows10, MacOS11 and Ubuntu22. Thanks!

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: