Crash in [@ mozilla::Maybe<T>::operator* | nsIWidget::TouchSwipeState::GetDelta]
Categories
(Core :: Panning and Zooming, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr153 | --- | unaffected |
| firefox159 | --- | unaffected |
| firefox160 | --- | unaffected |
| firefox161 | --- | fixed |
| firefox162 | --- | fixed |
People
(Reporter: clouseau-bot, Assigned: canalun)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: crash, regression)
Crash Data
Attachments
(1 external file)
Crash report: https://crash-stats.mozilla.org/report/index/4f015887-8c76-4596-bc7b-54e100261104
MOZ_CRASH Reason:
MOZ_RELEASE_ASSERT(isSome())
Top 10 frames:
0 xul.dll nsIWidget::MayStartSwipeForTouchInput(mozilla::MultiTouchInput const&, mozilla::... widget/nsIWidget.cpp:1345
1 xul.dll nsIWidget::DispatchTouchInput(mozilla::MultiTouchInput&) widget/nsIWidget.cpp:1507
2 xul.dll nsWindow::OnTouchPointerEvents(unsigned int, unsigned int, unsigned long long, l... widget/windows/nsWindow.cpp:8464
3 xul.dll nsWindow::OnPointerEvents(unsigned int, unsigned long long, long long) widget/windows/nsWindow.cpp:8227
4 xul.dll nsWindow::ProcessMessageInternal(unsigned int, unsigned long long&, long long&, ... widget/windows/nsWindow.cpp:5425
5 xul.dll nsWindow::WindowProcInternal(HWND__*, unsigned int, unsigned long long, long lon... widget/windows/nsWindow.cpp:4776
6 xul.dll nsWindow::WindowProc(HWND__*, unsigned int, unsigned long long, long long) widget/windows/nsWindow.cpp:4733
7 user32.dll UserCallWinProcCheckWow(_ACTIVATION_CONTEXT*, int64_t (*)(tagWND*, unsigned int,...
8 user32.dll DispatchMessageWorker
9 xul.dll NS_ProcessNextEvent(nsIThread*, bool) xpcom/threads/nsThreadUtils.cpp:471
There are 5 crashes (from 5 installations) in nightly 161 starting with buildid 20261103080110.
This signature is new: its first report anywhere is in build 20261103080110 (2026-11-03), the build above.
Clouseau analysis (automated, 72% worth investigating — a calibrated estimate that this is worth someone's time, not that the changeset below caused it). The mechanism below fits the evidence but is not proven end-to-end:
nsIWidget::MayStartSwipeForTouchInput dereferences an empty TouchSwipeState::previousTouchPoint in GetDelta() when a MULTITOUCH_MOVE arrives while the swipe phase is Idle; here that is probably because touches were undercounted on the WM_POINTER touch path.
- eea5a3340120 added touchscreen swipe-to-nav, enabled on Nightly through
widget.swipe.touchscreen.enabled; forMULTITOUCH_MOVEit only debug-asserts the phase and then callsGetDelta()unconditionally. - 64937b3aab8d resets
TouchSwipeStatetoIdlewhenevertouchCounterreaches 0 onMULTITOUCH_END, andReset()clearspreviousTouchPoint. - In this crash the input came from
nsWindow::OnTouchPointerEvents, which probably fills a WM_POINTERUP'sMULTITOUCH_ENDwith every contact in the pointer frame (GetPointerFrameTouchInfo), whileTouchCounter::Updatesubtracts all of them as if they were released. - So lifting one of two fingers can probably drop the count to 0, and the state becomes
Idlewhile a finger is still down. - The remaining finger's next WM_POINTERUPDATE becomes a
MULTITOUCH_MOVE; inIdleit passes theRejectedearly-return and reachesGetDelta(), where*previousTouchPointhitsMOZ_RELEASE_ASSERT(isSome()).
The crash reason MOZ_RELEASE_ASSERT(isSome()), the inlined Maybe::operator* in GetDelta at nsIWidget.cpp:1345, and the OnPointerEvents → OnTouchPointerEvents frames fit this chain. The source shows directly that only Idle can reach this line with Nothing. How Idle was reached (steps 3–4) is inferred from the code and depends on Windows pointer-frame behaviour that I did not verify; the WM_TOUCH split described in bug 2088553 comment 3 is another way to reach Idle, but not the one this stack took.
The signature was first seen in build 20261103080110, the first build after the bug 2085126 series landed on 2026-11-02. Blame puts the crashing GetDelta line and the MOVE fall-through in eea5a3340120, and the count-based Reset() in 64937b3aab8d. The feature pref added by eea5a3340120 is on by default in Nightly, so the code runs for every Nightly touchscreen user. None of the 5 reports carries a bit-flip or Raptor Lake flag. Bug 2088553 is open on the same signature, but its proposed cause is WM_TOUCH, while this report went through the WM_POINTER path.
Suspected regressor: eea5a3340120 (gh) (bug 2085126) by :canalun.
Impact
The parent process crashes, so the whole browser closes.
Possible fixes
- In
MayStartSwipeForTouchInput, treat aMULTITOUCH_MOVE(or END) arriving inPhase::Idleas reject or ignore instead of falling through toGetDelta(), for exampleif (mTouchSwipeState.phase != TouchSwipeState::Phase::Pending) return;after the switch. - On the WM_POINTER touch path, build the
MULTITOUCH_ENDwith only the contacts flaggedPOINTER_FLAG_UP, soTouchCounterdoes not undercount (this probably also affects APZ's ownTouchCounter). - Make
TouchSwipeState::GetDeltareturn a fallible result (e.g.Maybe<ScreenIntPoint>) so a missing start point rejects the swipe instead of crashing.
How to confirm
With dom.w3c_pointer_events.dispatch_by_pointer_messages.touch=true and widget.swipe.touchscreen.enabled=true on a Windows touchscreen, put down finger A, put down finger B, lift B, then move A. Log touchCounter.GetActiveTouchCount() and mTouches.Length() for each MULTITOUCH_END in DispatchTouchInput to confirm the count drops to 0 while A is down. A gtest or browser test that calls DispatchTouchInput with an END listing both touches, followed by a MOVE, should hit the assert.
Code references:
- widget/nsIWidget.cpp:1314
- widget/nsIWidget.cpp:1306
- mozilla::layers::TouchCounter::Update
- mozilla::widget::WinPointerEvents::GetPointerFrameTouchInfo
- modules/libpref/init/StaticPrefList.yaml:21808
What the automated skeptic pass checked
In its own words (a pass means the check succeeded, which is not always support for the conclusion):
- unverifiable trigger — That
GetPointerFrameTouchInforeturns still-down contacts on WM_POINTERUP is Windows API behaviour that the tools cannot check. The WM_TOUCH split from bug 2088553 comment 3 cannot be what happened here, because this stack goes throughOnTouchPointerEvents. That path runs only whendom.w3c_pointer_events.dispatch_by_pointer_messages.touchis on, and it defaults to false. - pass mechanism — Self-checked; the skeptic subagent was not run. In the build source, only the
Idlephase can reachGetDeltafromMayStartSwipeForTouchInputwithpreviousTouchPoint == Nothing. The fall-through and theGetDeltacall blame to eea5a3340120, which also addedwidget.swipe.touchscreen.enableddefaulting to@IS_NIGHTLY_BUILD@. The signature is first seen in this build. - pass noise-check — 11e385cb5285 only adds an early
rejectSwipe()beforeGetDeltawhen a touchpad swipe is active. That cannot produceIdlewithNothing; it is part of the same series but not the cause.
Filed as a new bug rather than a comment on bug 2088553: it is open on this signature but appears to track a different defect.
- Bug 2088553: The bug's crash and its diagnosed cause and fix in comment 3 are on the WM_TOUCH path (nsWindow::OnTouch). The draft's crash takes the WM_POINTER path (OnPointerEvents/OnTouchPointerEvents) with a different proposed trigger, even though...
Please duplicate if that is wrong.
:canalun, can you have a look please?
Filed automatically by Clouseau with an LLM, from a submitted crash report: not an independent Mozilla discovery
Filed automatically by Clouseau, which analyses nightly crashes with an LLM. Nothing above was written or checked by a human. Please close it as INVALID if it is wrong — that is useful feedback, not a nuisance.
This is not an independent Mozilla discovery: the crash is known here only because somebody submitted the crash report linked at the top. If this duplicates an existing report, please resolve THIS bug as the duplicate and leave the credit with the earlier reporter.
Comment 1•24 days ago
|
||
Set release status flags based on info from the regressing bug 2085126
| Assignee | ||
Comment 2•24 days ago
|
||
Considering the fact that the same assertion in GetDelta() fails and it might be caused by TOUCH_MOVE in Idle phase, this will be fixed by the patch for bug 2088553.
Once I confirm the suspected behavior of nsWindow::OnTouchPointerEvents (i.e., probably fills a WM_POINTERUP's MULTITOUCH_END with every contact in the pointer frame), I will file a bug and add a reference to that on the codebase.
| Assignee | ||
Updated•24 days ago
|
| Assignee | ||
Comment 3•24 days ago
•
|
||
Although it's a crash in parent process, both dom.w3c_pointer_events.dispatch_by_pointer_messages.touch and widget.swipe.touchscreen.enabled have to be switched to true in order to produce the bug. So for now I've marked this bug as S3.
Comment 4•23 days ago
|
||
Set release status flags based on info from the regressing bug 2085126
Updated•19 days ago
|
| Assignee | ||
Comment 5•18 days ago
•
|
||
I confirmed the below.
- This bug is NOT reproduced on the latest Nightly (162.0a1 2026-11-10) thanks to the fix of bug 2088553
- The described behavior of
OnTouchPointerEventswas reproduced on my Windows laptop.
I filed a bug, bug 2091573, for the bug of OnTouchPointerEvents.
Updated•16 days ago
|
| Assignee | ||
Comment 7•11 days ago
|
||
Bug 2091573, a bug of Windows widget, causes the situation in which
MULTITOUCH_END makes the touch count 0 and resets the phase even
though the finger is still on the screen.
The fix for bug 2089005, a Windows widget bug causing the same
situation, prevents a crash caused by bug 2091573 as well. So, this
patch adds a mention in the code comment as future reference.
No test is added, because the MULTITOUCH_END including several
contacts is necessary to trigger bug 2091573 and such input can't
be reproduced on mochitest.
(With native injection, nsWindow::InjectTouchPoint passes only a
single contact to InjectTouchInput. With
apz.test.fails_with_native_injection enabled, the synthesized
MULTITOUCH_END contains only the lifted touch.)
Updated•11 days ago
|
Comment 9•10 days ago
|
||
| bugherder | ||
Comment 10•10 days ago
|
||
A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)
Description
•