TouchEvent.changedTouches empty for emulated touchstart events in capture mode
Categories
(DevTools :: Responsive Design Mode, defect, P3)
Tracking
(firefox72 fixed)
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: ossman, Assigned: mtigley)
References
(Blocks 2 open bugs)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0
Steps to reproduce:
- window.addEventListener('touchstart', foo, { capture: true });
- Try to examine TouchEvent.changedTouches[0]
Actual results:
Crash!
TypeError: event.changedTouches[0] is undefined
Expected results:
No crash.
Reporter | ||
Comment 1•5 years ago
|
||
Note that this concerns the emulator, not real touch events. It also only happens for capture listeners.
Also not in the test file that doing "console.log(event);" makes the problem go away. Something similar can also be seen by doing "console.log(event.changedTouches.length)" just before the crash and then enable "Pause on exceptions". The console will then clearly have printed "0", yet the debugger shows event.changedTouches to have a length of 1.
I.e. it really looks like there is a race here where the JavaScript is executed before the event object is properly set up.
Reporter | ||
Comment 2•5 years ago
|
||
This was noticed with noVNC, so it happens in real world code.
Comment 3•5 years ago
|
||
Hi Pierre!
We can not test because we don´t have the proper environment.
Beyond this, could you try to reproduce it in the latest Nightly version and let us know the results?.
You can download Nightly from here: https://nightly.mozilla.org/.
I'll add a product and component so the corresponding team can take a look at this
Reporter | ||
Comment 4•5 years ago
|
||
Ehm... You should be able to test this on any Linux machine. Probably any Windows or macOS machine as well.
Still, I did a test with nightly and it has the same bug.
Comment 5•5 years ago
|
||
(In reply to Pierre Ossman from comment #1)
Note that this concerns the emulator, not real touch events.
What do you mean by "emulator" here? Are you referring to Tools -> Web Developer -> Responsive Design Mode?
Comment 6•5 years ago
|
||
I guess so, I can reproduce the issue in RDM.
(Note: I can only reproduce it with WebRender disabled. With WebRender enabled, I can't get the event handler to fire at all, which is probably an unrelated issue with RDM being broken with WebRender.)
Moving to the RDM component for triage, though based on a quick look, RDM does populate the changedTouches
field, so perhaps the issue is at the DOM bindings level?
Assignee | ||
Comment 7•5 years ago
|
||
I am able to reproduce this issue on RDM with macOS after refreshing the page when the above example is loaded.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 8•5 years ago
|
||
RDM's touch simulator uses deprecated web API's when creating the touch events it's trying to simulate. See: https://searchfox.org/mozilla-central/source/devtools/server/actors/emulation/touch-simulator.js#331 .
A good first step is to refactor the use of these deprecated API's and replace them with their appropriate equivalents:
Assignee | ||
Comment 9•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 10•5 years ago
|
||
It seems like the refactoring in Comment 9 fixes this issue (yay!) and also Bug 1549220. I'll clean-up this patch and get it ready for a review.
Comment 11•5 years ago
|
||
Comment 12•5 years ago
|
||
bugherder |
Description
•