On Thu Feb 9 16:20:38 2023 +0000, Jacek Caban wrote:
I'm not sure about the details, but yes, moving delaying code out of `dispatch_event()` (to its callers) seems right. That should make the blocking actually simpler: I think that we don't need depth-based testing. I'd expect that async events should be able to be simply blocked or not. Using thread data is also a bit questionable. We could have two separated iframes or even totally separated HTML document instances (as in HTMLDocumentObj) and with your solution they'd block each other. I guess that's why Gecko uses per-document blocking. Maybe it would be a good idea to do something similar? Note that even XHRs can be associated with a document that was used to create them.
Isn't javascript still "single threaded" (or rather, sequential) with two separate iframes? It would be pretty weird to do a "sync" send() and end up in an unrelated handler from such script. This should extend to more than just script though, should exhibit it from C code as well.
Good point about multiple HTMLDocumentObj, I'll see if I can add some tests for that and for iframes.