Closed Bug 1907494 Opened 2 months ago Closed 2 months ago

`LinearEasingFunctionWidget.#onMouseDown` uses `Element.setPointerCapture` with `undefined`

Categories

(DevTools :: Shared Components, defect)

defect

Tracking

(firefox-esr115 wontfix, firefox-esr128 wontfix, firefox128 wontfix, firefox129 wontfix, firefox130 fixed)

RESOLVED FIXED
130 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox128 --- wontfix
firefox129 --- wontfix
firefox130 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

https://searchfox.org/mozilla-central/rev/f7b41fc41c5505db507d076c16961a8da67dd318/devtools/client/shared/widgets/LinearEasingFunctionWidget.js#196

  #onMouseDown(event) {
    if (
      !event.target.classList.contains(
        LinearEasingFunctionWidget.CONTROL_POINTS_CLASSNAME
      )
    ) {
      return;
    }

    this.#draggedEl = event.target;
    this.#draggedEl.setPointerCapture(event.pointerId);

This is a mousedown event listener. So, event is a MouseEvent interface, but MouseEvent does not have pointerId.
https://searchfox.org/mozilla-central/rev/f7b41fc41c5505db507d076c16961a8da67dd318/dom/webidl/MouseEvent.webidl

So, the value must be undefined which can be treated as 0. 0 is used for mouse events and first touch of active touches. Therefore, this could work as expected for mouse inputs, but this may cause unexpected exception if the event is the compatibility mouse events of Touch Events. Additionally, this pointerId value is set by different rules from the other browsers. Therefore, the value could be changed for solving web compat issues.

I think that it should listen to pointerdown, pointerup and pointercancel instead, and it should handle it only when the pointerType is mouse.

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

:nchevobbe, since you are the author of the regressor, bug 1773549, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Flags: needinfo?(nchevobbe)

MouseEvent.pointerId is undefined so that setPointerCapture(undefined)
means setPointerCapture(0) and it captures both click of mouse and first
touch of touch input devices. Therefore, for getting correct pointerId,
it needs to listen to pointerdown. Then, we make it listen to pointerdown
and pointerup events because mousedown and mouseup are always fired after
pointerdown and pointerup (mousemove and pointermove are really
different, therefore, it needs to keep listening to mousemove). Finally,
they are handling a drag during a button press. Therefore, they are designed
only for mouse devices. Therefore, this patch makes the pointerdown listener
start to handle a drag only when the device type is "mouse".

Note that the pointer capture will be released when all pointers of the device
are inactivated. Therefore, it does not need explicitly to release the capture.

Depends on D217215

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/68311369dd22
Make `LinearEasingFunctionWidget` listen to `pointerdown` to capture the pointer r=nchevobbe,devtools-reviewers
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
See Also: → 1909803
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: