Open Bug 1904859 Opened 1 year ago Updated 1 month ago

Check performance when dispatching events in the parent process

Categories

(Remote Protocol :: Agent, task, P3)

task
Points:
3

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

(Whiteboard: [webdriver:m20])

To rule out race conditions when dispatching events from an action chain, especially when multiple actions run in parallel within a tick, we need to ensure that the required events are indeed dispatched. Event listeners must be installed in the content process to wait for the events to be processed by the browser and the related events to be emitted before returning to the parent process for further processing of the action chain.

Further we should try to minimize the performance degradation caused by the additional step of waiting for the event to be dispatched. We should compare the results with Chrome's timings to ensure the impact is kept as low as possible.

Depends on: 1904671
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Whiteboard: [webdriver:m12] → [webdriver:m13]
No longer blocks: 1926576

This work will be needed once we emit widget events. With just processing actions in the parent process but still synthesizing events in the content process we basically have no change in how the events are dispatched. Because we do not wait for the event to be dispatched now, we won't need it immediately.

With bug 1922077 we will release the first chunk of work to our users. As such lets move this bug into M14.

No longer blocks: 1871346, 1918610
Whiteboard: [webdriver:m13] → [webdriver:m14]

I actually need some widget events implemented first before I can see how this will work. As such lets block on bug 1848957 which will implement the first widget event (wheel scroll).

Also not sure if it's immediately necessary so I'm going to set it as P3 for M14 and if I don't get to it lets prioritize as P2 again in the next milestone.

Assignee: hskupin → nobody
No longer blocks: 1848957
Status: ASSIGNED → NEW
Depends on: 1848957
Priority: P2 → P3
Whiteboard: [webdriver:m14] → [webdriver:m15]
Whiteboard: [webdriver:m15] → [webdriver:m16]
Priority: P3 → P2

Note that on bug 1962560 a workaround fix got landed which waits for 2 rAF's before continuing in the test after dispatching a wheel scroll event. Once we are waiting for the event to be dispatched we should remove it again.

Depends on: 1963550
Depends on: 1968645

For widget wheel scroll events I can see the following:

async=false (log) - 33ms:

[task 2025-06-13T06:09:30.004+00:00] 06:09:30     INFO - STDOUT: 1749794970000	Marionette	DEBUG	0 -> [0,4,"WebDriver:PerformActions",{"actions":[{"actions":[{"deltaX":5,"deltaY":10,"origin":{"element-6066-11e4-a52e-4f735466cecf":"d6813369-c523-4f24-a874-86c977000336"},"type":"scroll","x":0,"y":0}],"id":"wheel_id","type":"wheel"}]}]
[task 2025-06-13T06:09:30.009+00:00] 06:09:30     INFO - STDOUT: 1749794970007	RemoteAgent	TRACE	Dispatching tick 1/1
[task 2025-06-13T06:09:30.021+00:00] 06:09:30     INFO - STDOUT: 1749794970018	RemoteAgent	TRACE	Dispatch WheelScrollAction with id: wheel_id pageX: 58 pageY: 319 deltaX: 5 deltaY: 10 async: false
[task 2025-06-13T06:09:30.023+00:00] 06:09:30     INFO - STDOUT: 1749794970018	RemoteAgent	TRACE	moveOverTime start: 0,0 target: 5,10 duration: 0
[task 2025-06-13T06:09:30.024+00:00] 06:09:30     INFO - STDOUT: 1749794970018	RemoteAgent	TRACE	WheelScrollAction.performOneWheelScrollStep [5,10]
[task 2025-06-13T06:09:30.037+00:00] 06:09:30     INFO - STDOUT: 1749794970033	Marionette	DEBUG	0 <- [1,4,null,{"value":null}]

async=true (log) - 35ms:

[task 2025-06-13T15:26:54.200+00:00] 15:26:54     INFO - STDOUT: 1749828414198	Marionette	DEBUG	0 -> [0,4,"WebDriver:PerformActions",{"actions":[{"actions":[{"deltaX":5,"deltaY":10,"origin":{"element-6066-11e4-a52e-4f735466cecf":"175e62bf-5e5c-4426-ac74-e647e7c73b79"},"type":"scroll","x":0,"y":0}],"id":"wheel_id","type":"wheel"}]}]
[task 2025-06-13T15:26:54.206+00:00] 15:26:54     INFO - STDOUT: 1749828414204	RemoteAgent	TRACE	Dispatching tick 1/1
[task 2025-06-13T15:26:54.217+00:00] 15:26:54     INFO - STDOUT: 1749828414215	RemoteAgent	TRACE	Dispatch WheelScrollAction with id: wheel_id pageX: 58 pageY: 319 deltaX: 5 deltaY: 10 async: true
[task 2025-06-13T15:26:54.219+00:00] 15:26:54     INFO - STDOUT: 1749828414217	RemoteAgent	TRACE	moveOverTime start: 0,0 target: 5,10 duration: 0
[task 2025-06-13T15:26:54.220+00:00] 15:26:54     INFO - STDOUT: 1749828414217	RemoteAgent	TRACE	WheelScrollAction.performOneWheelScrollStep [5,10]
[task 2025-06-13T15:26:54.223+00:00] 15:26:54     INFO - STDOUT: 1749828414220	RemoteAgent	TRACE	WebDriverProcessData actor created for PID 60030
[task 2025-06-13T15:26:54.224+00:00] 15:26:54     INFO - STDOUT: 1749828414221	Marionette	TRACE	[1] MarionetteCommands actor created for window id 2
[task 2025-06-13T15:26:54.237+00:00] 15:26:54     INFO - STDOUT: 1749828414233	Marionette	DEBUG	0 <- [1,4,null,{"value":null}]

So even with dispatching the event in the parent process and passing it through APZ we do not seem to have any performance regression. But note that is just by inspecting a single performAction command.

For a full assessment I need mouse and touch events as well. Given that this will not happen in M16 lets push to M17.

No longer blocks: 1797215
Depends on: 1848958, 1797215
Whiteboard: [webdriver:m16] → [webdriver:m17]
Points: 8 → 3
Summary: Wait for events dispatched in the content process and assess performance → Check performance when dispatching events in the parent process
Whiteboard: [webdriver:m17] → [webdriver:m18]

We are running short for M18 so we agreed on to move this to M19.

Whiteboard: [webdriver:m18] → [webdriver:m19]

When manually inspecting the performance with async events so far I do not see a regression. As such lets still keep it in M19 (as discussed) but de-prioritize it.

Priority: P2 → P3
Whiteboard: [webdriver:m19] → [webdriver:m20]
You need to log in before you can comment on or make changes to this bug.