[Webkit-unassigned] [Bug 213025] SelectionChange event fires before mutationobserver event when devtools are closed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Mar 26 01:36:33 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=213025

--- Comment #3 from Martin Middel <martin.middel at fontoxml.com> ---
I seem to have a workaround. Adding a selectionchange notifier VERY early in the startup of the web application seems to mitigate the problem.

We basically have a process that at some point relatively late in the start-up of out web application that sets up a mutation observer. I tried to work around this problem by attempting to flush the mutationObserver's records by calling its takeRecords method during a selection change. This caused the bug on our side to no occur anymore. However, after closer inspection, the event listener was never being called with any outstanding records. I removed all dead code and made this minimal event listener:


window.document.addEventListener('selectionchange', _event => {
        return;
});

This is indeed a function with no real body. This fixes the bug. I am however so far unable to apply this 'workaround' to the codepen case. 
This is being executed on the module level of our code. This makes it run before anything sensible is being executed. I suspect this is because of some timing.


I hope this helps anyone else unlucky enough to run into this bug.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210326/ee39bae3/attachment-0001.htm>


More information about the webkit-unassigned mailing list