Closed Bug 1961816 Opened 28 days ago Closed 22 days ago

Microtasks posted from a direct macOS event don't run until an arbitrary checkpoint inside a gecko event.

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox140 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

(Whiteboard: [viewtransitions:m1])

Attachments

(2 files)

This is the root cause of bug 1960926. The TLDR is:

  • The macOS event set-up doesn't use Gecko events.
  • That gets us to run random JS (mouseup events and so on) with a RecursionDepth() of zero.
  • That makes microtask checkpoints not run here (because 0 >= 0).
  • That causes the microtasks to run basically on whatever arbitrary microtask checkpoint happens inside a Gecko task, which in bug 1960926 was the nsRefreshDriver animation checkpoint.

I think the code in RunMicrotaskCheckpoints should be more robust, but ideally we also fix that the event nesting level issue.

Account for native event loop nesting level.

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Summary: Microtasks posted from a direct macOS event don't run. → Microtasks posted from a direct macOS event don't run until an arbitrary checkpoint inside a gecko event.

Emilio, thanks for working on the regression in bug 1961816 - should this have tracking to get this fix into 139 along with bug 1960926?

Flags: needinfo?(emilio)

No, this should land after the freeze, it's a bit riskier change.

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/152a0c0ed6c4 Run microtask checkpoints on direct widget events correctly. r=smaug
Status: ASSIGNED → RESOLVED
Closed: 22 days ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch
Whiteboard: [viewtransitions:m1]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: