Jacek Caban (@jacek) commented about dlls/mshtml/task.c:
+ * for each event later on to what it's supposed to be (most notably, XHR's readyState). + * So unfortunately we have to hardcode and snapshot the XHR state for async events... + * + * While queuing an event this way would not work correctly with their default behavior + * in Gecko (preventDefault() can't be called because we need to *delay* the default, + * rather than prevent it completely), Gecko does suppress events reaching the document + * during the sync XHR event loop, so all the element/node events should be safe. If we + * find an event that has defaults on Gecko's side and isn't delayed by Gecko, we need + * to figure out a way to handle it... + * + * For details (and bunch of problems to consider) see: https://bugzil.la/697151 + */ + window->base.outer_window->readystate_locked++; + window->blocking_depth++; + thread_data->blocking_depth++; + nsres = nsIXMLHttpRequest_Send(nsxhr, nsbody); It's a bit weird to do that call here, maybe we should instead expose block and unblock functions from task.c and leave XHR details out of it.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/2098#note_24387