Gabriel Ivăncescu : mshtml: Implement window.location setter with a hook.
Alexandre Julliard
julliard at winehq.org
Sat Aug 13 14:19:16 CDT 2022
Module: wine
Branch: master
Commit: e275b2197b23996172c112877c85c9b4459c0611
URL: https://gitlab.winehq.org/wine/wine/-/commit/e275b2197b23996172c112877c85c9b4459c0611
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Fri Aug 12 17:07:29 2022 +0300
mshtml: Implement window.location setter with a hook.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
dlls/mshtml/htmlwindow.c | 48 ++++++++++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 20 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 3ab42af0fa4..c3267e1e4ca 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -3619,24 +3619,6 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
TRACE("(%p)->(%lx %lx %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
switch(id) {
- case DISPID_IHTMLWINDOW2_LOCATION: {
- HTMLLocation *location;
- HRESULT hres;
-
- if(!(wFlags & DISPATCH_PROPERTYPUT))
- break;
-
- TRACE("forwarding to location.href\n");
-
- hres = get_location(window, &location);
- if(FAILED(hres))
- return hres;
-
- hres = IDispatchEx_InvokeEx(&location->dispex.IDispatchEx_iface, DISPID_VALUE, lcid,
- wFlags, pdp, pvarRes, pei, pspCaller);
- IHTMLLocation_Release(&location->IHTMLLocation_iface);
- return hres;
- }
case DISPID_IHTMLWINDOW2_SETTIMEOUT:
case DISPID_IHTMLWINDOW3_SETTIMEOUT: {
VARIANT args[2];
@@ -3912,8 +3894,34 @@ static void HTMLWindow_bind_event(DispatchEx *dispex, eventid_t eid)
ensure_doc_nsevent_handler(This->doc, NULL, eid);
}
+static HRESULT IHTMLWindow2_location_hook(DispatchEx *dispex, WORD flags, DISPPARAMS *dp, VARIANT *res,
+ EXCEPINFO *ei, IServiceProvider *caller)
+{
+ HTMLInnerWindow *This = impl_from_DispatchEx(dispex);
+ HTMLLocation *location;
+ HRESULT hres;
+
+ if(!(flags & DISPATCH_PROPERTYPUT))
+ return S_FALSE;
+
+ TRACE("forwarding to location.href\n");
+
+ hres = get_location(This, &location);
+ if(FAILED(hres))
+ return hres;
+
+ hres = IDispatchEx_InvokeEx(&location->dispex.IDispatchEx_iface, DISPID_VALUE, 0, flags, dp, res, ei, caller);
+ IHTMLLocation_Release(&location->IHTMLLocation_iface);
+ return hres;
+}
+
static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode)
{
+ static const dispex_hook_t window2_hooks[] = {
+ {DISPID_IHTMLWINDOW2_LOCATION, IHTMLWindow2_location_hook},
+ {DISPID_UNKNOWN}
+ };
+
if(compat_mode >= COMPAT_MODE_IE9)
dispex_info_add_interface(info, IHTMLWindow7_tid, NULL);
else
@@ -3922,6 +3930,8 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa
dispex_info_add_interface(info, IWineHTMLWindowPrivate_tid, NULL);
dispex_info_add_interface(info, IHTMLWindow5_tid, NULL);
+ dispex_info_add_interface(info, IHTMLWindow3_tid, NULL);
+ dispex_info_add_interface(info, IHTMLWindow2_tid, window2_hooks);
EventTarget_init_dispex_info(info, compat_mode);
}
@@ -3948,8 +3958,6 @@ static const event_target_vtbl_t HTMLWindow_event_target_vtbl = {
};
static const tid_t HTMLWindow_iface_tids[] = {
- IHTMLWindow2_tid,
- IHTMLWindow3_tid,
IHTMLWindow4_tid,
IHTMLWindow6_tid,
0
More information about the wine-cvs
mailing list