From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 6 ++++++ dlls/jscript/jscript.h | 9 +++++---- dlls/mshtml/dispex.c | 10 ++++++++-- dlls/mshtml/htmldoc.c | 6 ++++++ dlls/mshtml/htmlstorage.c | 6 ++++++ dlls/mshtml/htmlwindow.c | 6 ++++++ dlls/mshtml/mshtml_private.h | 3 +++ 7 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 5c72640a599..110c021b6b8 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -737,11 +737,15 @@ static HRESULT fill_props(jsdisp_t *obj) HRESULT hres; DWORD i;
+ if(obj->props_filled) + return S_OK; + for(i = 0; i < obj->builtin_info->props_cnt; i++) { hres = find_prop_name(obj, string_hash(obj->builtin_info->props[i].name), obj->builtin_info->props[i].name, FALSE, NULL, &prop); if(FAILED(hres)) return hres; } + hres = S_OK;
if(obj->builtin_info->fill_props) { hres = obj->builtin_info->fill_props(obj); @@ -749,6 +753,8 @@ static HRESULT fill_props(jsdisp_t *obj) return hres; }
+ if(hres == S_OK) + obj->props_filled = TRUE; return S_OK; }
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 6f4266edd44..4f21cae941b 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -198,10 +198,11 @@ struct jsdisp_t {
LONG ref;
- BOOLEAN has_weak_refs; - BOOLEAN extensible; - BOOLEAN gc_marked; - BOOLEAN is_constructor; + BOOLEAN is_constructor : 1; + BOOLEAN has_weak_refs : 1; + BOOLEAN props_filled : 1; + BOOLEAN extensible : 1; + BOOLEAN gc_marked : 1;
DWORD buf_size; DWORD prop_cnt; diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 0290d61f04c..9d0b8593409 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2761,11 +2761,17 @@ static HRESULT WINAPI JSDispatchHost_FillProperties(IWineJSDispatchHost *iface) { DispatchEx *This = impl_from_IWineJSDispatchHost(iface); DISPID id = DISPID_STARTENUM; + HRESULT hres, retval = S_OK; struct property_info desc; - HRESULT hres;
TRACE("%s (%p)->(%lx)\n", This->info->name, This, id);
+ if(This->info->vtbl->fill_props) { + retval = This->info->vtbl->fill_props(This); + if(FAILED(retval)) + return retval; + } + for(;;) { hres = dispex_next_id(This, id, TRUE, &id); if(FAILED(hres)) @@ -2782,7 +2788,7 @@ static HRESULT WINAPI JSDispatchHost_FillProperties(IWineJSDispatchHost *iface) return hres; }
- return S_OK; + return retval; }
static HRESULT WINAPI JSDispatchHost_GetOuterDispatch(IWineJSDispatchHost *iface, IWineJSDispatchHost **ret) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index ca55b8e1d5b..2fa58ccbecb 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5532,6 +5532,11 @@ static HRESULT HTMLDocumentNode_get_prop_desc(DispatchEx *dispex, DISPID id, str return S_OK; }
+static HRESULT HTMLDocumentNode_fill_props(DispatchEx *dispex) +{ + return S_FALSE; +} + static HTMLInnerWindow *HTMLDocumentNode_get_script_global(DispatchEx *dispex, dispex_static_data_t **dispex_data) { HTMLDocumentNode *This = impl_from_DispatchEx(dispex); @@ -5640,6 +5645,7 @@ static const event_target_vtbl_t HTMLDocument_event_target_vtbl = { .invoke = HTMLDocumentNode_invoke, .disp_invoke = HTMLDocumentNode_disp_invoke, .next_dispid = HTMLDocumentNode_next_dispid, + .fill_props = HTMLDocumentNode_fill_props, .get_script_global = HTMLDocumentNode_get_script_global, }, .get_gecko_target = HTMLDocumentNode_get_gecko_target, diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index 632469d0f9b..337705207af 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -1277,6 +1277,11 @@ static HRESULT HTMLStorage_get_prop_desc(DispatchEx *dispex, DISPID id, struct p return S_OK; }
+static HRESULT HTMLStorage_fill_props(DispatchEx *dispex) +{ + return S_FALSE; +} + static const dispex_static_data_vtbl_t Storage_dispex_vtbl = { .query_interface = HTMLStorage_query_interface, .destructor = HTMLStorage_destructor, @@ -1287,6 +1292,7 @@ static const dispex_static_data_vtbl_t Storage_dispex_vtbl = { .delete = HTMLStorage_delete, .next_dispid = HTMLStorage_next_dispid, .get_prop_desc = HTMLStorage_get_prop_desc, + .fill_props = HTMLStorage_fill_props, };
static const tid_t HTMLStorage_iface_tids[] = { diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index c964fdb9b02..ba4ca530094 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4036,6 +4036,11 @@ HRESULT HTMLWindow_get_prop_desc(DispatchEx *dispex, DISPID id, struct property_ return hres; }
+static HRESULT HTMLWindow_fill_props(DispatchEx *dispex) +{ + return S_FALSE; +} + static HTMLInnerWindow *HTMLWindow_get_script_global(DispatchEx *dispex, dispex_static_data_t **dispex_data) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); @@ -4232,6 +4237,7 @@ static const event_target_vtbl_t HTMLWindow_event_target_vtbl = { .delete = HTMLWindow_delete, .next_dispid = HTMLWindow_next_dispid, .get_prop_desc = HTMLWindow_get_prop_desc, + .fill_props = HTMLWindow_fill_props, .get_script_global = HTMLWindow_get_script_global, .get_outer_iface = HTMLWindow_get_outer_iface, }, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 573a0b6bf63..3e321a7d36d 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -401,6 +401,9 @@ typedef struct { HRESULT (*next_dispid)(DispatchEx*,DISPID,DISPID*); HRESULT (*get_prop_desc)(DispatchEx*,DISPID,struct property_info*);
+ /* Used when the object has props it has to fill prior to enumeration, or if it's volatile to not cache it (return S_FALSE then) */ + HRESULT (*fill_props)(DispatchEx*); + /* Similar to invoke, but allows overriding all dispids */ HRESULT (*disp_invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);