From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 21 +++++++++++++++++++++ dlls/mshtml/htmlelem.c | 5 ++++- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/documentmode.js | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index e9ef3ea9f98..103a8f7718b 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1816,6 +1816,27 @@ HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp, return call_builtin_function(dispex, func, dp, res, ei, caller); }
+BOOL dispex_is_builtin_method(DispatchEx *dispex, DISPID id) +{ + func_info_t *func; + + if(get_dispid_type(id) != DISPEXPROP_BUILTIN) + return FALSE; + + if(FAILED(get_builtin_func(dispex->info, id, &func)) || func->func_disp_idx < 0) + return FALSE; + + if(dispex->dynamic_data && dispex->dynamic_data->func_disps) { + func_obj_entry_t *entry = dispex->dynamic_data->func_disps + func->func_disp_idx; + + if(entry->func_obj && (V_VT(&entry->val) != VT_DISPATCH || + V_DISPATCH(&entry->val) != (IDispatch*)&entry->func_obj->dispex.IWineJSDispatchHost_iface)) + return FALSE; + } + + return TRUE; +} + static VARIANT_BOOL reset_builtin_func(DispatchEx *dispex, func_info_t *func) { func_obj_entry_t *entry; diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index f988d394b45..cb510ea15ae 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -7829,7 +7829,10 @@ static inline HRESULT get_attr_dispid_by_name(HTMLAttributeCollection *This, con return *nsattr ? S_OK : DISP_E_UNKNOWNNAME; }
- return dispex_get_id(&This->elem->node.event_target.dispex, name, fdexNameCaseInsensitive, id); + hres = dispex_get_id(&This->elem->node.event_target.dispex, name, fdexNameCaseInsensitive, id); + if(FAILED(hres)) + return hres; + return dispex_is_builtin_method(&This->elem->node.event_target.dispex, *id) ? DISP_E_UNKNOWNNAME : S_OK; }
static inline HRESULT get_domattr(HTMLAttributeCollection *This, DISPID id, nsIDOMAttr *nsattr, LONG *list_pos, HTMLDOMAttribute **attr) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index bc262292829..fab7aeae6de 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -631,6 +631,7 @@ const void *dispex_get_vtbl(DispatchEx*); void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*); void dispex_info_add_dispids(dispex_data_t*,tid_t,const DISPID*); compat_mode_t dispex_compat_mode(DispatchEx*); +BOOL dispex_is_builtin_method(DispatchEx*,DISPID); HRESULT dispex_to_string(DispatchEx*,BSTR*); HRESULT dispex_call_builtin(DispatchEx *dispex, DISPID id, DISPPARAMS *dp, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller); diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 282365d7c1e..e3bff0e296f 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -295,7 +295,7 @@ sync_test("builtin_toString", function() { if(!localStorage) win_skip("localStorage is buggy and not available, skipping");
test("attribute", document.createAttribute("class"), "Attr"); - if(false /* todo_wine */) test("attributes", e.attributes, "NamedNodeMap"); + test("attributes", e.attributes, "NamedNodeMap"); test("childNodes", document.body.childNodes, "NodeList"); if(clientRects) test("clientRect", clientRects[0], "ClientRect"); if(clientRects) test("clientRects", clientRects, "ClientRectList");