https://bugzilla.wikimedia.org/show_bug.cgi?id=53079

--- Comment #5 from David Chan <[email protected]> ---
I can reproduce this just by holding a key down for a few seconds. It seems to
be because of setTimeout( f(), 0 ) causing event handling to overlap. This
could be challenging to resolve because of the way browser event handling
works. Gory details below :-)

On my slow Ubuntu laptop, I can reliably reproduce the bug. It happens if I
just hold the 'x' key down inside a <h1> for a couple of seconds.

I'm pretty sure it's happening because we use setTimeout to process events.
This can get complex up when two events are emitted by the browser at virtually
the same time. In this case, ve.ce.SurfaceObserver.onDocumentKeyDown receives
event 1, does some processing, then effectively does a setTimeout( f(), 0 ) to
finish the processing. But by that time, the browser has already queued the
handlers for event 2, so the processing for event 2 will start before the
processing for event 1 has finished.

I tested this by putting two lines at the top of onDocumentKeydown: a
ve.log("main...") and a setTimeout( ve.log("post..."), 0) . The corruption
happens exactly when we get "main..." twice in a row followed by "post..."
twice in a row. See http://pastebin.com/dzGYbpDq for full output.

This may be challenging to resolve, because we probably need to do stuff both
before and after the browser's native keydown handler. We can't manage all the
handling in our own queue, because (afaik) the browser's native handling can't
be postponed. So it seems the only obvious option would be to detect when there
are overlapping events, and try and do act delicately enough that things don't
break.

Timo, any thoughts?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to