Closed Bug 1857622 Opened 8 months ago Closed 7 months ago

Race condition when data-l10n attributes are updated when customize mode is in the foreground

Categories

(Core :: Internationalization, defect)

defect

Tracking

()

VERIFIED FIXED
120 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox118 --- wontfix
firefox119 --- verified
firefox120 --- verified

People

(Reporter: tgiles, Assigned: emilio)

References

Details

(Keywords: regression)

Attachments

(2 files)

It appears that L10nMutations reliance on nsRefreshDriver can cause a race condition when the customize mode page is in the foreground causing background tabs to lose the ability to dynamically update their strings. This bug comes from https://bugzilla.mozilla.org/show_bug.cgi?id=1856572#c11 where :mconley found the underlying issue. (If this needs to be duplicated back to the blocking bug, feel free to do so).

STR:

  1. Navigate to Firefox View
  2. Right-click in the toolbar and select Customize Toolbar
  3. Navigate back to Firefox View and either open the migration wizard (if available) or go to Open Tabs, open the submenu, and hover/activate the "Move Tab" option

ER:

  1. Strings are translated correctly

AR:

  1. Translated strings are missing

Additional STR from the blocked bug (works on Mac):

  1. Visit about:preferences, and scroll to the "Tabs" section
  2. Open the devtools for the page, and paste in this script and press enter:
let changeCount = 0;
let node = document.querySelector("#warnOnQuitKey");
setInterval(() => {
  node.setAttribute("data-l10n-args", JSON.stringify({"quitKey":changeCount}))
  changeCount++;
}, 1000);
  1. Notice that the "Confirm before quitting" string is having a number increment once a second.
  2. Here's where experience playing Guitar Hero comes in - you have to time it so that you enter customize mode just as the number is about to change.
  3. Exit customize mode, and notice how the number has stopped incrementing. If you open up the DevTools, however, you'll notice that the data-l10n-args attribute is being updated still. This might take a few tries, but I can do it fairly consistently with one or two attempts.

I think this bug belongs here but please move to a more appropriate spot as needed.

See Also: → 1842809
Keywords: regression
Regressed by: 1842809
See Also: 1842809

Actually, I suppose this bug has always existed, bug 1842809 just made it obvious with customize mode.

No longer regressed by: 1842809
See Also: → 1842809
Flags: needinfo?(emilio)

This bug has been marked as a regression. Setting status flag for Nightly to affected.

Assignee: nobody → emilio
Flags: needinfo?(emilio)

This doesn't fix the bug but seems worth doing. I can't think of any
reason why this null-check would be needed.

This is the actual bug fix.

If we were an observer of a detached refresh driver, we won't observe
the new one.

Depends on D190574

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/483fb312c27a
Remove a useless null-check. r=smaug
https://hg.mozilla.org/integration/autoland/rev/fcde87df3b93
Make sure to get the new refresh driver when getting a new presshell. r=smaug

Hey emilio,

I think the Firefox View gang was hoping to have the issue in bug 1856572 (which is caused by this bug) fixed within Firefox 119. This patch stack seems fairly minimal - do you think we'd be safe to request an uplift for it?

Flags: needinfo?(emilio)

Comment on attachment 9357618 [details]
Bug 1857622 - Make sure to get the new refresh driver when getting a new presshell. r=smaug

Beta/Release Uplift Approval Request

  • User impact if declined: bug 1856572
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0 or bug 1856572.
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): trivial-ish fix. Note that I didn't include a test in the hopes that :tgiles had one ready but I should add test coverage for this otherwise. Still shouldn't block uplift, it's a fairly low-risk fix.
  • String changes made/needed: none
  • Is Android affected?: No
Flags: needinfo?(emilio)
Attachment #9357618 - Flags: approval-mozilla-beta?
Attachment #9357617 - Flags: approval-mozilla-beta?
Status: NEW → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 120 Branch

Comment on attachment 9357617 [details]
Bug 1857622 - Remove a useless null-check. r=smaug

Approved for 119.0b9

Attachment #9357617 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9357618 [details]
Bug 1857622 - Make sure to get the new refresh driver when getting a new presshell. r=smaug

Approved for 119.0b9

Attachment #9357618 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Flags: qe-verify+
QA Whiteboard: [qa-triaged]

Verified as fixed in Firefox 120.0a1 and Firefox 119.0b9 Windows 10x64, macOS 14 and Ubuntu 18.

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

Attachment

General

Created:
Updated:
Size: