Jacek Caban (@jacek) commented about dlls/mshtml/nsio.c:
+ hres = IUri_GetDisplayUri(This->uri->uri, &display_uri); + if (FAILED(hres)) { + IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface); + return NS_ERROR_UNEXPECTED; + } + + hres = IHTMLWindow2_get_name(&window->base.IHTMLWindow2_iface, &frame_name); + if (FAILED(hres)) { + IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface); + SysFreeString(display_uri); + return NS_ERROR_UNEXPECTED; + } + + browser = window->base.outer_window->browser; + hres = IDocObjectService_FireBeforeNavigate2(browser->doc->doc_object_service, NULL, display_uri, 0, frame_name, NULL, 0, NULL, TRUE, &cancel);
Doing that here would fire for each binding we perform, including things like CSS, scripts, and images. If we want to catch only document bindings, see `before_async_open` in `nsChannel_AsyncOpen`. It's currently guarded by `is_main_content_window`, so it won't trigger, and at least some of that probably should remain guarded, but I guess it would fit better there. A test in MSHTML itself (like in `tests/htmldoc.c`) would more precisely show us how it's supposed to work, by avoiding the ieframe layer. Also, it may be more convenient to use the res: protocol and embed the source in resources, we already have a few of those. If http is important for some reason, we could add the iframe source to test.winehq.org. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8727#note_112267