Closed Bug 1889697 Opened 6 months ago Closed 6 months ago

Translations don't work across private/non-private windows

Categories

(Firefox :: Translations, defect)

defect

Tracking

()

VERIFIED FIXED
126 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox124 --- unaffected
firefox125 --- verified
firefox126 --- verified

People

(Reporter: marco, Assigned: nordzilla)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

After the first time I translate in a non-private window, translations don't work anymore in private windows.
Same happens in the other direction.

Mozregression says:
96:48.62 INFO: Last good revision: ad3e0a193f6695c9133975ca3d272236bf4fa59f
96:48.62 INFO: First bad revision: c21d8e0ee576012d309a4cbd267e9e54b660e605
96:48.62 INFO: Pushlog:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=ad3e0a193f6695c9133975ca3d272236bf4fa59f&tochange=c21d8e0ee576012d309a4cbd267e9e54b660e605

It could be either bug 1870327 or bug 1870300.

Flags: needinfo?(enordin)
Keywords: regression

I dug into this and found that the regression is here:

Bug 1870327
https://phabricator.services.mozilla.com/D201282


This is where I refactored the way that the language lists are built to be in the shared class here.

The new code stores the initialized state based on the panel's element ID. So, when full-page-translations-panel gets its language lists initialized, that gets put into the map as "initialized".

This appears to break when someone opens up a new window after translating, not just a private window.

I looked into adding the PID to the map as a differentiator, but that's not aggressive enough: all the windows still have the same parent process.

I then looked into adding the innerWindowId as a differentiator, but that is too aggressive: even new tabs get a different innerWindowId.

It's not really clear to me at the moment why the FullPageTranslationsPanel class, which is a singleton class, seems to be losing information when the TranslationsPanelShared class, which is just a class with static members and functions, is retaining information within the same process.

I'm going to keep looking into this.

Fixes an issue where the cached state for the Translations
Panel's lanuage list initializtion was too aggressive across
new window instances. Now considers the inner window id
when caching the state.

Assignee: nobody → enordin
Status: NEW → ASSIGNED
Regressed by: 1870327

This is slightly wrong. I think in my haste to debug this I somehow logged the innerWindowId incorrectly.

The innerWindowId does seem to be what we want. I'm uploading a patch.

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

Pushed by enordin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1b9e06dfd0cd Consider windowId for TranslationsPanel Initialization r=translations-reviewers,gregtatum

Fixes an issue where the cached state for the Translations
Panel's lanuage list initializtion was too aggressive across
new window instances. Now considers the inner window id
when caching the state.

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

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

beta Uplift Approval Request

  • User impact if declined: The Full-Page Translations panel will fail to populate the language lists if users attempt to translate with two Firefox windows open at the same time.
  • Code covered by automated testing: no
  • Fix verified in Nightly: yes
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing: Open more than one Firefox window at the same time and try to invoke Full-Page Translations in both of them
  • Risk associated with taking this patch: Low risk
  • Explanation of risk level: This is a few-line change that concatenates an extra identifier onto a string key to a map.
  • String changes made/needed: None
  • Is Android affected?: no
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
Attachment #9395194 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: needinfo?(enordin)
QA Whiteboard: [qa-triaged]
Flags: qe-verify+

Reproduced the issue with Firefox 126.0a1 (2024-04-04) on Windows 10x64. After opening a new normal or private window the translation panel will be empty for the Translate from and Translate to dropdowns.
The issue is verified fixed with Firefox 125.0RC1 and 126.0a1 (2024-04-08) on Windows 10x64, macOS 13 and Ubuntu 23.10. The Translate from and Translate to dropdowns are successfully populated with languages after following steps from comment 8. Note that bug 1890494 was encountered during testing.

Status: RESOLVED → VERIFIED
Has STR: --- → yes
QA Whiteboard: [qa-triaged]
Flags: qe-verify+
Regressions: 1892541
Regressions: 1894085
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: