Module: wine Branch: master Commit: b133812b63db6e39978d232e29ec81b64521bd2a URL: https://gitlab.winehq.org/wine/wine/-/commit/b133812b63db6e39978d232e29ec81b...
Author: Jacek Caban jacek@codeweavers.com Date: Thu May 30 00:08:34 2024 +0200
mshtml: Use DispatchEx vtbl for all window properties.
---
dlls/mshtml/dispex.c | 12 ++++++++++-- dlls/mshtml/htmlwindow.c | 18 +++++++++--------- dlls/mshtml/mshtml_private.h | 3 +++ 3 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 8517ccac554..152d2d4cb66 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -994,6 +994,13 @@ static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **re static HRESULT get_builtin_id(DispatchEx *This, BSTR name, DWORD grfdex, DISPID *ret) { int min, max, n, c; + HRESULT hres; + + if(This->info->desc->vtbl->lookup_dispid) { + hres = This->info->desc->vtbl->lookup_dispid(This, name, grfdex, ret); + if(hres != DISP_E_UNKNOWNNAME) + return hres; + }
min = 0; max = This->info->func_cnt-1; @@ -1017,8 +1024,6 @@ static HRESULT get_builtin_id(DispatchEx *This, BSTR name, DWORD grfdex, DISPID }
if(This->info->desc->vtbl->get_dispid) { - HRESULT hres; - hres = This->info->desc->vtbl->get_dispid(This, name, grfdex, ret); if(hres != DISP_E_UNKNOWNNAME) return hres; @@ -1800,6 +1805,9 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR nam
TRACE("%s (%p)->(%s %lx)\n", This->info->desc->name, This, debugstr_w(name), grfdex);
+ if(dispex_compat_mode(This) < COMPAT_MODE_IE8 && !This->info->desc->vtbl->delete) + return E_NOTIMPL; + hres = IDispatchEx_GetDispID(&This->IDispatchEx_iface, name, grfdex & ~fdexNameEnsure, &id); if(FAILED(hres)) { compat_mode_t compat_mode = dispex_compat_mode(This); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index be07072600c..0230cca86e5 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3699,16 +3699,8 @@ HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex, static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) { HTMLWindow *This = impl_from_IDispatchEx(iface); - HTMLInnerWindow *window = This->inner_window; - HRESULT hres; - - TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(bstrName), grfdex, pid); - - hres = search_window_props(window, bstrName, grfdex, pid); - if(hres != DISP_E_UNKNOWNNAME) - return hres;
- return IDispatchEx_GetDispID(&window->base.inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex, pid); + return IDispatchEx_GetDispID(&This->inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex, pid); }
static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, @@ -4069,6 +4061,13 @@ static HRESULT HTMLWindow_get_name(DispatchEx *dispex, DISPID id, BSTR *name) return (*name = SysAllocString(This->global_props[idx].name)) ? S_OK : E_OUTOFMEMORY; }
+static HRESULT HTMLWindow_lookup_dispid(DispatchEx *dispex, BSTR name, DWORD grfdex, DISPID *dispid) +{ + HTMLInnerWindow *This = impl_from_DispatchEx(dispex); + + return search_window_props(This, name, grfdex, dispid); +} + static HRESULT HTMLWindow_find_dispid(DispatchEx *dispex, BSTR name, DWORD grfdex, DISPID *dispid) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); @@ -4401,6 +4400,7 @@ static const event_target_vtbl_t HTMLWindow_event_target_vtbl = { .unlink = HTMLWindow_unlink, .last_release = HTMLWindow_last_release, .get_name = HTMLWindow_get_name, + .lookup_dispid = HTMLWindow_lookup_dispid, .find_dispid = HTMLWindow_find_dispid, .invoke = HTMLWindow_invoke, .next_dispid = HTMLWindow_next_dispid, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 52d53ca9e00..98a417726f2 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -374,6 +374,9 @@ typedef struct { /* Similar to get_dispid, but called only when a dynamic property can't be found */ HRESULT (*find_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
+ /* Similar to get_dispid, but called before any other lookup */ + HRESULT (*lookup_dispid)(DispatchEx*,BSTR,DWORD,DISPID*); + /* These are called when the object implements GetMemberName, InvokeEx, DeleteMemberByDispID and GetNextDispID for custom props */ HRESULT (*get_name)(DispatchEx*,DISPID,BSTR*); HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);