From: Gabriel Ivăncescu gabrielopcode@gmail.com
No-op, but this describes the intent better, as we're not enumerating enumerable props only, we're filling them for enumeration done on jscript side (this is not called during enumeration itself, but as a prequel), and will be needed later.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 99 +++++++++++++++++++++------------------- dlls/jscript/function.c | 16 +++---- dlls/jscript/jscript.h | 4 +- dlls/jscript/jsdisp.idl | 3 +- dlls/jscript/string.c | 22 ++++----- dlls/mshtml/dispex.c | 45 +++++++++++------- dlls/mshtml/htmlwindow.c | 7 ++- 7 files changed, 107 insertions(+), 89 deletions(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 058945d1a5f..5c72640a599 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -501,21 +501,6 @@ HRESULT jsdisp_index_lookup(jsdisp_t *obj, const WCHAR *name, unsigned length, s return S_OK; }
-HRESULT jsdisp_next_index(jsdisp_t *obj, unsigned length, unsigned id, struct property_info *desc) -{ - if(id + 1 == length) - return S_FALSE; - - desc->id = id + 1; - desc->flags = PROPF_ENUMERABLE; - if(obj->builtin_info->prop_put) - desc->flags |= PROPF_WRITABLE; - desc->name = NULL; - desc->index = desc->id; - desc->iid = 0; - return S_OK; -} - static IDispatch *get_this(DISPPARAMS *dp) { DWORD i; @@ -758,31 +743,10 @@ static HRESULT fill_props(jsdisp_t *obj) return hres; }
- if(obj->builtin_info->next_prop) { - struct property_info desc; - unsigned id = ~0; - WCHAR buf[12]; - - for(;;) { - hres = obj->builtin_info->next_prop(obj, id, &desc); - if(FAILED(hres)) - return hres; - if(hres == S_FALSE) - break; - - if(!desc.name) { - swprintf(buf, ARRAYSIZE(buf), L"%u", desc.index); - desc.name = buf; - } - - prop = lookup_dispex_prop(obj, string_hash(desc.name), desc.name, FALSE); - if(!prop) { - hres = update_external_prop(obj, desc.name, NULL, &desc, &prop); - if(FAILED(hres)) - return hres; - } - id = desc.id; - } + if(obj->builtin_info->fill_props) { + hres = obj->builtin_info->fill_props(obj); + if(FAILED(hres)) + return hres; }
return S_OK; @@ -2426,6 +2390,25 @@ static HRESULT WINAPI WineJSDispatch_DefineProperty(IWineJSDispatch *iface, cons return hres; }
+static HRESULT WINAPI WineJSDispatch_UpdateProperty(IWineJSDispatch *iface, struct property_info *desc) +{ + jsdisp_t *This = impl_from_IWineJSDispatch(iface); + const WCHAR *name = desc->name; + dispex_prop_t *prop; + HRESULT hres = S_OK; + WCHAR buf[12]; + + if(!name) { + swprintf(buf, ARRAYSIZE(buf), L"%u", desc->index); + name = buf; + } + + if(!(prop = lookup_dispex_prop(This, string_hash(name), name, FALSE))) + hres = update_external_prop(This, name, NULL, desc, &prop); + + return hres; +} + static HRESULT WINAPI WineJSDispatch_GetScriptGlobal(IWineJSDispatch *iface, IWineJSDispatchHost **ret) { jsdisp_t *This = impl_from_IWineJSDispatch(iface); @@ -2460,6 +2443,7 @@ static IWineJSDispatchVtbl DispatchExVtbl = { WineJSDispatch_Free, WineJSDispatch_GetPropertyFlags, WineJSDispatch_DefineProperty, + WineJSDispatch_UpdateProperty, WineJSDispatch_GetScriptGlobal, };
@@ -3095,6 +3079,27 @@ HRESULT disp_delete(IDispatch *disp, DISPID id, BOOL *ret) return S_OK; }
+HRESULT jsdisp_fill_indices(jsdisp_t *obj, unsigned length) +{ + struct property_info desc; + HRESULT hres; + + desc.flags = PROPF_ENUMERABLE; + if(obj->builtin_info->prop_put) + desc.flags |= PROPF_WRITABLE; + desc.name = NULL; + desc.iid = 0; + + for(desc.index = 0; desc.index < length; desc.index++) { + desc.id = desc.index; + hres = WineJSDispatch_UpdateProperty(&obj->IWineJSDispatch_iface, &desc); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} + HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, enum jsdisp_enum_type enum_type, DISPID *ret) { dispex_prop_t *iter; @@ -3530,25 +3535,25 @@ static HRESULT HostObject_prop_put(jsdisp_t *jsdisp, unsigned idx, jsval_t v) return hres; }
-static HRESULT HostObject_next_prop(jsdisp_t *jsdisp, unsigned id, struct property_info *desc) +static HRESULT HostObject_prop_delete(jsdisp_t *jsdisp, unsigned id) { HostObject *This = HostObject_from_jsdisp(jsdisp);
- return IWineJSDispatchHost_NextProperty(This->host_iface, id, desc); + return IWineJSDispatchHost_DeleteProperty(This->host_iface, id); }
-static HRESULT HostObject_prop_delete(jsdisp_t *jsdisp, unsigned id) +static HRESULT HostObject_prop_config(jsdisp_t *jsdisp, unsigned id, unsigned flags) { HostObject *This = HostObject_from_jsdisp(jsdisp);
- return IWineJSDispatchHost_DeleteProperty(This->host_iface, id); + return IWineJSDispatchHost_ConfigureProperty(This->host_iface, id, flags); }
-static HRESULT HostObject_prop_config(jsdisp_t *jsdisp, unsigned id, unsigned flags) +static HRESULT HostObject_fill_props(jsdisp_t *jsdisp) { HostObject *This = HostObject_from_jsdisp(jsdisp);
- return IWineJSDispatchHost_ConfigureProperty(This->host_iface, id, flags); + return IWineJSDispatchHost_FillProperties(This->host_iface); }
static HRESULT HostObject_to_string(jsdisp_t *jsdisp, jsstr_t **ret) @@ -3573,9 +3578,9 @@ static const builtin_info_t HostObject_info = { .lookup_prop = HostObject_lookup_prop, .prop_get = HostObject_prop_get, .prop_put = HostObject_prop_put, - .next_prop = HostObject_next_prop, .prop_delete = HostObject_prop_delete, .prop_config = HostObject_prop_config, + .fill_props = HostObject_fill_props, .to_string = HostObject_to_string, };
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 54b8f5abe2f..ffb55af0922 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -137,12 +137,6 @@ static HRESULT Arguments_lookup_prop(jsdisp_t *jsdisp, const WCHAR *name, unsign return jsdisp_index_lookup(&arguments->jsdisp, name, arguments->argc, desc); }
-static HRESULT Arguments_next_prop(jsdisp_t *jsdisp, unsigned id, struct property_info *desc) -{ - ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); - return jsdisp_next_index(&arguments->jsdisp, arguments->argc, id, desc); -} - static jsval_t *get_argument_ref(ArgumentsInstance *arguments, unsigned idx) { if(arguments->buf) @@ -179,6 +173,12 @@ static HRESULT Arguments_prop_put(jsdisp_t *jsdisp, unsigned idx, jsval_t val) return S_OK; }
+static HRESULT Arguments_fill_props(jsdisp_t *jsdisp) +{ + ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); + return jsdisp_fill_indices(&arguments->jsdisp, arguments->argc); +} + static HRESULT Arguments_gc_traverse(struct gc_ctx *gc_ctx, enum gc_traverse_op op, jsdisp_t *jsdisp) { ArgumentsInstance *arguments = arguments_from_jsdisp(jsdisp); @@ -240,9 +240,9 @@ static const builtin_info_t Arguments_info = { .props = Arguments_props, .destructor = Arguments_destructor, .lookup_prop = Arguments_lookup_prop, - .next_prop = Arguments_next_prop, .prop_get = Arguments_prop_get, .prop_put = Arguments_prop_put, + .fill_props = Arguments_fill_props, .gc_traverse = Arguments_gc_traverse };
@@ -251,9 +251,9 @@ static const builtin_info_t Arguments_ES5_info = { .call = Arguments_value, .destructor = Arguments_destructor, .lookup_prop = Arguments_lookup_prop, - .next_prop = Arguments_next_prop, .prop_get = Arguments_prop_get, .prop_put = Arguments_prop_put, + .fill_props = Arguments_fill_props, .gc_traverse = Arguments_gc_traverse };
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index d42dd3a8a8a..6f4266edd44 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -184,11 +184,11 @@ typedef struct { ULONG (*release)(jsdisp_t*); void (*on_put)(jsdisp_t*,const WCHAR*); HRESULT (*lookup_prop)(jsdisp_t*,const WCHAR*,unsigned,struct property_info*); - HRESULT (*next_prop)(jsdisp_t*,unsigned,struct property_info*); HRESULT (*prop_get)(jsdisp_t*,unsigned,jsval_t*); HRESULT (*prop_put)(jsdisp_t*,unsigned,jsval_t); HRESULT (*prop_delete)(jsdisp_t*,unsigned); HRESULT (*prop_config)(jsdisp_t*,unsigned,unsigned); + HRESULT (*fill_props)(jsdisp_t*); HRESULT (*to_string)(jsdisp_t*,jsstr_t**); HRESULT (*gc_traverse)(struct gc_ctx*,enum gc_traverse_op,jsdisp_t*); } builtin_info_t; @@ -263,7 +263,7 @@ HRESULT jsdisp_get_idx_id(jsdisp_t*,DWORD,DISPID*); HRESULT disp_delete(IDispatch*,DISPID,BOOL*); HRESULT disp_delete_name(script_ctx_t*,IDispatch*,jsstr_t*,BOOL*); HRESULT jsdisp_index_lookup(jsdisp_t*,const WCHAR*,unsigned,struct property_info*); -HRESULT jsdisp_next_index(jsdisp_t*,unsigned,unsigned,struct property_info*); +HRESULT jsdisp_fill_indices(jsdisp_t*,unsigned); HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD); HRESULT jsdisp_get_own_property(jsdisp_t*,const WCHAR*,BOOL,property_desc_t*); HRESULT jsdisp_define_property(jsdisp_t*,const WCHAR*,property_desc_t*); diff --git a/dlls/jscript/jsdisp.idl b/dlls/jscript/jsdisp.idl index c55626fae66..a96214a98b6 100644 --- a/dlls/jscript/jsdisp.idl +++ b/dlls/jscript/jsdisp.idl @@ -53,6 +53,7 @@ interface IWineJSDispatch : IDispatchEx void Free(); HRESULT GetPropertyFlags(DISPID id, UINT32 *ret); HRESULT DefineProperty(const WCHAR *name, unsigned int flags, VARIANT *v); + HRESULT UpdateProperty(struct property_info *desc); HRESULT GetScriptGlobal(IWineJSDispatchHost **ret); }
@@ -65,13 +66,13 @@ interface IWineJSDispatchHost : IDispatchEx { HRESULT GetJSDispatch(IWineJSDispatch **ret); HRESULT LookupProperty(const WCHAR *name, DWORD flags, struct property_info *desc); - HRESULT NextProperty(DISPID id, struct property_info *desc); HRESULT GetProperty(DISPID id, LCID lcid, VARIANT *r, EXCEPINFO *ei, IServiceProvider *caller); HRESULT SetProperty(DISPID id, LCID lcid, VARIANT *v, EXCEPINFO *ei, IServiceProvider *caller); HRESULT DeleteProperty(DISPID id); HRESULT ConfigureProperty(DISPID id, UINT32 flags); HRESULT CallFunction(DISPID id, UINT32 iid, DWORD flags, DISPPARAMS *dp, VARIANT *ret, EXCEPINFO *ei, IServiceProvider *caller); HRESULT Construct(LCID lcid, DWORD flags, DISPPARAMS *dp, VARIANT *ret, EXCEPINFO *ei, IServiceProvider *caller); + HRESULT FillProperties(); HRESULT GetOuterDispatch(IWineJSDispatchHost **ret); HRESULT ToString(BSTR *str); } diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 968b74f9602..42a2c697fbc 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -1517,16 +1517,6 @@ static HRESULT String_lookup_prop(jsdisp_t *jsdisp, const WCHAR *name, unsigned return jsdisp_index_lookup(&string->dispex, name, jsstr_length(string->str), desc); }
-static HRESULT String_next_prop(jsdisp_t *jsdisp, unsigned id, struct property_info *desc) -{ - StringInstance *string = string_from_jsdisp(jsdisp); - - if(string->dispex.ctx->version < 2) - return S_FALSE; - - return jsdisp_next_index(&string->dispex, jsstr_length(string->str), id, desc); -} - static HRESULT String_prop_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) { StringInstance *string = string_from_jsdisp(jsdisp); @@ -1542,6 +1532,16 @@ static HRESULT String_prop_get(jsdisp_t *jsdisp, unsigned idx, jsval_t *r) return S_OK; }
+static HRESULT String_fill_props(jsdisp_t *jsdisp) +{ + StringInstance *string = string_from_jsdisp(jsdisp); + + if(string->dispex.ctx->version < 2) + return S_OK; + + return jsdisp_fill_indices(&string->dispex, jsstr_length(string->str)); +} + static const builtin_prop_t String_props[] = { {L"anchor", String_anchor, PROPF_METHOD|1}, {L"big", String_big, PROPF_METHOD}, @@ -1596,8 +1596,8 @@ static const builtin_info_t StringInst_info = { .props = StringInst_props, .destructor = String_destructor, .lookup_prop = String_lookup_prop, - .next_prop = String_next_prop, .prop_get = String_prop_get, + .fill_props = String_fill_props, };
/* ECMA-262 3rd Edition 15.5.3.2 */ diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 43896729a9e..0290d61f04c 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2670,21 +2670,6 @@ static HRESULT WINAPI JSDispatchHost_LookupProperty(IWineJSDispatchHost *iface, return get_host_property_descriptor(This, id, desc); }
-static HRESULT WINAPI JSDispatchHost_NextProperty(IWineJSDispatchHost *iface, DISPID id, struct property_info *desc) -{ - DispatchEx *This = impl_from_IWineJSDispatchHost(iface); - DISPID next; - HRESULT hres; - - TRACE("%s (%p)->(%lx)\n", This->info->name, This, id); - - hres = dispex_next_id(This, id, TRUE, &next); - if(hres != S_OK) - return hres; - - return get_host_property_descriptor(This, next, desc); -} - static HRESULT WINAPI JSDispatchHost_GetProperty(IWineJSDispatchHost *iface, DISPID id, LCID lcid, VARIANT *r, EXCEPINFO *ei, IServiceProvider *caller) { @@ -2772,6 +2757,34 @@ static HRESULT WINAPI JSDispatchHost_Construct(IWineJSDispatchHost *iface, LCID return dispex_prop_call(This, DISPID_VALUE, lcid, flags, dp, ret, ei, caller); }
+static HRESULT WINAPI JSDispatchHost_FillProperties(IWineJSDispatchHost *iface) +{ + DispatchEx *This = impl_from_IWineJSDispatchHost(iface); + DISPID id = DISPID_STARTENUM; + struct property_info desc; + HRESULT hres; + + TRACE("%s (%p)->(%lx)\n", This->info->name, This, id); + + for(;;) { + hres = dispex_next_id(This, id, TRUE, &id); + if(FAILED(hres)) + return hres; + if(hres == S_FALSE) + break; + + hres = get_host_property_descriptor(This, id, &desc); + if(FAILED(hres)) + return hres; + + hres = IWineJSDispatch_UpdateProperty(This->jsdisp, &desc); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} + static HRESULT WINAPI JSDispatchHost_GetOuterDispatch(IWineJSDispatchHost *iface, IWineJSDispatchHost **ret) { DispatchEx *This = impl_from_IWineJSDispatchHost(iface); @@ -2807,13 +2820,13 @@ static IWineJSDispatchHostVtbl JSDispatchHostVtbl = { DispatchEx_GetNameSpaceParent, JSDispatchHost_GetJSDispatch, JSDispatchHost_LookupProperty, - JSDispatchHost_NextProperty, JSDispatchHost_GetProperty, JSDispatchHost_SetProperty, JSDispatchHost_DeleteProperty, JSDispatchHost_ConfigureProperty, JSDispatchHost_CallFunction, JSDispatchHost_Construct, + JSDispatchHost_FillProperties, JSDispatchHost_GetOuterDispatch, JSDispatchHost_ToString, }; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 8913c4e511c..c964fdb9b02 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3439,12 +3439,11 @@ static HRESULT WINAPI WindowDispEx_LookupProperty(IWineJSDispatchHost *iface, co name, flags, desc); }
-static HRESULT WINAPI WindowDispEx_NextProperty(IWineJSDispatchHost *iface, DISPID id, struct property_info *desc) +static HRESULT WINAPI WindowDispEx_FillProperties(IWineJSDispatchHost *iface) { HTMLOuterWindow *This = impl_from_IWineJSDispatchHost(iface);
- return IWineJSDispatchHost_NextProperty(&This->base.inner_window->event_target.dispex.IWineJSDispatchHost_iface, - id, desc); + return IWineJSDispatchHost_FillProperties(&This->base.inner_window->event_target.dispex.IWineJSDispatchHost_iface); }
static HRESULT WINAPI WindowDispEx_GetProperty(IWineJSDispatchHost *iface, DISPID id, LCID lcid, VARIANT *r, @@ -3531,13 +3530,13 @@ static const IWineJSDispatchHostVtbl WindowDispExVtbl = { WindowDispEx_GetNameSpaceParent, WindowDispEx_GetJSDispatch, WindowDispEx_LookupProperty, - WindowDispEx_NextProperty, WindowDispEx_GetProperty, WindowDispEx_SetProperty, WindowDispEx_DeleteProperty, WindowDispEx_ConfigureProperty, WindowDispEx_CallFunction, WindowDispEx_Construct, + WindowDispEx_FillProperties, WindowDispEx_GetOuterDispatch, WindowDispEx_ToString, };
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*);
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Prevent its existence from being flaky during getOwnPropertyNames.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 9d0b8593409..793c1e4eb67 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -3052,9 +3052,16 @@ static HRESULT prototype_find_dispid(DispatchEx *dispex, const WCHAR *name, DWOR return hres; }
+static HRESULT prototype_fill_props(DispatchEx *dispex) +{ + DISPID dispid; + return dispex_get_id(dispex, L"constructor", 0, &dispid); +} + static const dispex_static_data_vtbl_t prototype_dispex_vtbl = { .destructor = prototype_destructor, .find_dispid = prototype_find_dispid, + .fill_props = prototype_fill_props, };
HRESULT get_prototype(HTMLInnerWindow *script_global, object_id_t id, DispatchEx **ret)
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Prevent its existence from being flaky during getOwnPropertyNames.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 793c1e4eb67..90fca9f0dac 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -3176,6 +3176,12 @@ static HRESULT stub_constructor_find_dispid(DispatchEx *dispex, const WCHAR *nam return hres; }
+static HRESULT stub_constructor_fill_props(DispatchEx *dispex) +{ + DISPID dispid; + return dispex_get_id(dispex, L"prototype", 0, &dispid); +} + static const char *stub_constructor_get_name(DispatchEx *dispex) { struct stub_constructor *constr = stub_constructor_from_DispatchEx(dispex); @@ -3185,6 +3191,7 @@ static const char *stub_constructor_get_name(DispatchEx *dispex) static const dispex_static_data_vtbl_t stub_constructor_dispex_vtbl = { .destructor = stub_constructor_destructor, .find_dispid = stub_constructor_find_dispid, + .fill_props = stub_constructor_fill_props, .get_name = stub_constructor_get_name, };
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlwindow.c | 15 ++++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/documentmode.js | 117 ++++++++++++++++++++++++++++++ 3 files changed, 133 insertions(+)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index ba4ca530094..bc4964f8b3f 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4038,6 +4038,21 @@ HRESULT HTMLWindow_get_prop_desc(DispatchEx *dispex, DISPID id, struct property_
static HRESULT HTMLWindow_fill_props(DispatchEx *dispex) { + HTMLInnerWindow *This = impl_from_DispatchEx(dispex); + DISPID dispid; + HRESULT hres; + unsigned i; + + if(!This->static_props_filled) { + for(i = 0; i < ARRAYSIZE(constructor_names); i++) { + hres = dispex_get_id(&This->event_target.dispex, constructor_names[i], 0, &dispid); + if(FAILED(hres) && hres != DISP_E_UNKNOWNNAME) + return hres; + } + + This->static_props_filled = TRUE; + } + return S_FALSE; }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 3e321a7d36d..e12568c72d1 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -785,6 +785,7 @@ struct HTMLInnerWindow { IHTMLStorage *local_storage; IWineMSHTMLConsole *console;
+ BOOL static_props_filled; BOOL performance_initialized; VARIANT performance;
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index e35b978db46..0ec6a6b4a4f 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -83,6 +83,123 @@ if(window.addEventListener) { document.attachEvent("onunload", function() { ok(false, "unload fired on document"); }); }
+sync_test("window own props", function() { + if(!Object.getOwnPropertyNames) + return; + + test_own_props(window, "window", [ + ["ANGLE_instanced_arrays",11], "ActiveXObject", ["AesGcmEncryptResult",11], ["AnimationEvent",10], ["ApplicationCache",10], "Array", ["ArrayBuffer",10], "Attr", + "Audio", ["AudioTrack",10], ["AudioTrackList",10], "BeforeUnloadEvent", ["Blob",10], "BookmarkCollection", "Boolean", "CDATASection", "CSSFontFaceRule", "CSSImportRule", + ["CSSKeyframeRule",10], ["CSSKeyframesRule",10], "CSSMediaRule", "CSSNamespaceRule", "CSSPageRule", "CSSRule", "CSSRuleList", "CSSStyleDeclaration", "CSSStyleRule", + "CSSStyleSheet", "CanvasGradient", "CanvasPattern", "CanvasPixelArray", "CanvasRenderingContext2D", "CharacterData", "ClientRect", "ClientRectList", ["CloseEvent",10], + "CollectGarbage", "Comment", "CompositionEvent", ["Console",10], "ControlRangeCollection", "Coordinates", ["Crypto",11], ["CryptoOperation",11], "CustomEvent", + ["DOMError",10], "DOMException", "DOMImplementation", "DOMParser", ["DOMSettableTokenList",10], ["DOMStringList",10], ["DOMStringMap",11], ["DOMTokenList",10], + "DataTransfer", ["DataView",10], "Date", "Debug", ["DeviceAcceleration",11], ["DeviceMotionEvent",11], ["DeviceOrientationEvent",11], ["DeviceRotationRate",11], + "Document", "DocumentFragment", "DocumentType", "DragEvent", ["EXT_texture_filter_anisotropic",11], "Element", "Enumerator", "Error", ["ErrorEvent",10], "EvalError", + "Event", "EventException", ["File",10], ["FileList",10], ["FileReader",10], ["Float32Array",10], ["Float64Array",10], "FocusEvent", ["FormData",10], "Function", + "Geolocation", ["HTMLAllCollection",11], "HTMLAnchorElement", "HTMLAppletElement", "HTMLAreaElement", "HTMLAreasCollection", "HTMLAudioElement", "HTMLBGSoundElement", + "HTMLBRElement", "HTMLBaseElement", "HTMLBaseFontElement", "HTMLBlockElement", "HTMLBodyElement", "HTMLButtonElement", "HTMLCanvasElement", "HTMLCollection", + "HTMLDDElement", "HTMLDListElement", "HTMLDTElement", ["HTMLDataListElement",10], "HTMLDirectoryElement", "HTMLDivElement", ["HTMLDocument",11], "HTMLElement", + "HTMLEmbedElement", "HTMLFieldSetElement", "HTMLFontElement", "HTMLFormElement", "HTMLFrameElement", "HTMLFrameSetElement", "HTMLHRElement", "HTMLHeadElement", + "HTMLHeadingElement", "HTMLHtmlElement", "HTMLIFrameElement", "HTMLImageElement", "HTMLInputElement", "HTMLIsIndexElement", "HTMLLIElement", "HTMLLabelElement", + "HTMLLegendElement", "HTMLLinkElement", "HTMLMapElement", "HTMLMarqueeElement", "HTMLMediaElement", "HTMLMenuElement", "HTMLMetaElement", "HTMLModElement", + "HTMLNextIdElement", "HTMLOListElement", "HTMLObjectElement", "HTMLOptGroupElement", "HTMLOptionElement", "HTMLParagraphElement", "HTMLParamElement", "HTMLPhraseElement", + "HTMLPreElement", ["HTMLProgressElement",10], "HTMLQuoteElement", "HTMLScriptElement", "HTMLSelectElement", "HTMLSourceElement", "HTMLSpanElement", "HTMLStyleElement", + "HTMLTableCaptionElement", "HTMLTableCellElement", "HTMLTableColElement", "HTMLTableDataCellElement", "HTMLTableElement", "HTMLTableHeaderCellElement", + "HTMLTableRowElement", "HTMLTableSectionElement", "HTMLTextAreaElement", "HTMLTitleElement", ["HTMLTrackElement",10], "HTMLUListElement", "HTMLUnknownElement", + "HTMLVideoElement", "History", ["IDBCursor",10], ["IDBCursorWithValue",10], ["IDBDatabase",10], ["IDBFactory",10], ["IDBIndex",10], ["IDBKeyRange",10], + ["IDBObjectStore",10], ["IDBOpenDBRequest",10], ["IDBRequest",10], ["IDBTransaction",10], ["IDBVersionChangeEvent",10], "Image", "ImageData", "Infinity", + ["Int16Array",10], ["Int32Array",10], ["Int8Array",10], ["Intl",11], "JSON", ["Key",11], ["KeyOperation",11], ["KeyPair",11], "KeyboardEvent", "Location", + "MSBehaviorUrnsCollection", ["MSBlobBuilder",10], ["MSCSSMatrix",10], "MSCSSProperties", "MSCSSRuleList", "MSCompatibleInfo", "MSCompatibleInfoCollection", + "MSCurrentStyleCSSProperties", "MSEventObj", ["MSGesture",10], ["MSGestureEvent",10], ["MSGraphicsTrust",11], ["MSInputMethodContext",11], ["MSManipulationEvent",10], + ["MSMediaKeyError",11], ["MSMediaKeyMessageEvent",11], ["MSMediaKeyNeededEvent",11], ["MSMediaKeySession",11], ["MSMediaKeys",11], "MSMimeTypesCollection", + ["MSNamespaceInfo",0,9], ["MSNamespaceInfoCollection",0,9], "MSPluginsCollection", ["MSPointerEvent",10], ["MSPopupWindow",0,10], ["MSRangeCollection",10], + ["MSSelection",0,10], "MSSiteModeEvent", ["MSStream",10], ["MSStreamReader",10], "MSStyleCSSProperties", ["Map",11], "Math", "MediaError", "MediaList", + ["MediaQueryList",10], ["MediaSource",11], ["MessageChannel",10], "MessageEvent", ["MessagePort",10], ["MimeType",11], ["MimeTypeArray",11], "MouseEvent", + "MouseWheelEvent", "MutationEvent", ["MutationObserver",11], ["MutationRecord",11], "NaN", "NamedNodeMap", "Navigator", "Node", "NodeFilter", "NodeIterator", "NodeList", + "Number", ["OES_element_index_uint",11], ["OES_standard_derivatives",11], ["OES_texture_float",11], ["OES_texture_float_linear",11], "Object", "Option", + ["PageTransitionEvent",11], "Performance", "PerformanceEntry", "PerformanceMark", "PerformanceMeasure", "PerformanceNavigation", ["PerformanceNavigationTiming",11], + "PerformanceResourceTiming", "PerformanceTiming", ["Plugin",11], ["PluginArray",11], ["PointerEvent",11], ["PopStateEvent",10], "Position", "PositionError", + "ProcessingInstruction", ["ProgressEvent",10], "Range", "RangeError", "RangeException", "ReferenceError", "RegExp", "SVGAElement", "SVGAngle", "SVGAnimatedAngle", + "SVGAnimatedBoolean", "SVGAnimatedEnumeration", "SVGAnimatedInteger", "SVGAnimatedLength", "SVGAnimatedLengthList", "SVGAnimatedNumber", "SVGAnimatedNumberList", + "SVGAnimatedPreserveAspectRatio", "SVGAnimatedRect", "SVGAnimatedString", "SVGAnimatedTransformList", "SVGCircleElement", "SVGClipPathElement", + ["SVGComponentTransferFunctionElement",10], "SVGDefsElement", "SVGDescElement", "SVGElement", "SVGElementInstance", "SVGElementInstanceList", "SVGEllipseElement", + "SVGException", ["SVGFEBlendElement",10], ["SVGFEColorMatrixElement",10], ["SVGFEComponentTransferElement",10], ["SVGFECompositeElement",10], + ["SVGFEConvolveMatrixElement",10], ["SVGFEDiffuseLightingElement",10], ["SVGFEDisplacementMapElement",10], ["SVGFEDistantLightElement",10], ["SVGFEFloodElement",10], + ["SVGFEFuncAElement",10], ["SVGFEFuncBElement",10], ["SVGFEFuncGElement",10], ["SVGFEFuncRElement",10], ["SVGFEGaussianBlurElement",10], ["SVGFEImageElement",10], + ["SVGFEMergeElement",10], ["SVGFEMergeNodeElement",10], ["SVGFEMorphologyElement",10], ["SVGFEOffsetElement",10], ["SVGFEPointLightElement",10], + ["SVGFESpecularLightingElement",10], ["SVGFESpotLightElement",10], ["SVGFETileElement",10], ["SVGFETurbulenceElement",10], ["SVGFilterElement",10], "SVGGElement", + "SVGGradientElement", "SVGImageElement", "SVGLength", "SVGLengthList", "SVGLineElement", "SVGLinearGradientElement", "SVGMarkerElement", "SVGMaskElement", "SVGMatrix", + "SVGMetadataElement", "SVGNumber", "SVGNumberList", "SVGPathElement", "SVGPathSeg", "SVGPathSegArcAbs", "SVGPathSegArcRel", "SVGPathSegClosePath", "SVGPathSegCurvetoCubicAbs", + "SVGPathSegCurvetoCubicRel", "SVGPathSegCurvetoCubicSmoothAbs", "SVGPathSegCurvetoCubicSmoothRel", "SVGPathSegCurvetoQuadraticAbs", "SVGPathSegCurvetoQuadraticRel", + "SVGPathSegCurvetoQuadraticSmoothAbs", "SVGPathSegCurvetoQuadraticSmoothRel", "SVGPathSegLinetoAbs", "SVGPathSegLinetoHorizontalAbs", "SVGPathSegLinetoHorizontalRel", + "SVGPathSegLinetoRel", "SVGPathSegLinetoVerticalAbs", "SVGPathSegLinetoVerticalRel", "SVGPathSegList", "SVGPathSegMovetoAbs", "SVGPathSegMovetoRel", "SVGPatternElement", + "SVGPoint", "SVGPointList", "SVGPolygonElement", "SVGPolylineElement", "SVGPreserveAspectRatio", "SVGRadialGradientElement", "SVGRect", "SVGRectElement", "SVGSVGElement", + "SVGScriptElement", "SVGStopElement", "SVGStringList", "SVGStyleElement", "SVGSwitchElement", "SVGSymbolElement", "SVGTSpanElement", "SVGTextContentElement", "SVGTextElement", + "SVGTextPathElement", "SVGTextPositioningElement", "SVGTitleElement", "SVGTransform", "SVGTransformList", "SVGUnitTypes", "SVGUseElement", "SVGViewElement", "SVGZoomAndPan", + "SVGZoomEvent", "Screen", "ScriptEngine", "ScriptEngineBuildVersion", "ScriptEngineMajorVersion", "ScriptEngineMinorVersion", "Selection", ["Set",11], ["SourceBuffer",11], + ["SourceBufferList",11], "Storage", "StorageEvent", "String", "StyleMedia", "StyleSheet", "StyleSheetList", "StyleSheetPageList", ["SubtleCrypto",11], "SyntaxError", "Text", + "TextEvent", "TextMetrics", "TextRange", "TextRangeCollection", ["TextTrack",10], ["TextTrackCue",10], ["TextTrackCueList",10], ["TextTrackList",10], "TimeRanges", + ["TrackEvent",10], ["TransitionEvent",10], "TreeWalker", "TypeError", "UIEvent", "URIError", ["URL",10], ["Uint16Array",10], ["Uint32Array",10], ["Uint8Array",10], + ["Uint8ClampedArray",11], "VBArray", ["ValidityState",10], ["VideoPlaybackQuality",11], ["WEBGL_compressed_texture_s3tc",11], ["WEBGL_debug_renderer_info",11], ["WeakMap",11], + ["WebGLActiveInfo",11], ["WebGLBuffer",11], ["WebGLContextEvent",11], ["WebGLFramebuffer",11], ["WebGLObject",11], ["WebGLProgram",11], ["WebGLRenderbuffer",11], + ["WebGLRenderingContext",11], ["WebGLShader",11], ["WebGLShaderPrecisionFormat",11], ["WebGLTexture",11], ["WebGLUniformLocation",11], ["WebSocket",10], "WheelEvent", "Window", + ["Worker",10], ["XDomainRequest",0,10], ["XMLDocument",11], "XMLHttpRequest", ["XMLHttpRequestEventTarget",10], "XMLSerializer", "async_test", "broken", + "compat_version", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", "eval", "file_prefix", "format_message", "func_scope_val", "func_scope_val2", + "guard", "isFinite", "isNaN", "next_test", "ok", "pagehide_fired", "pageshow_fired", "parseFloat", "parseInt", "ready_states", "reportSuccess", "run_tests", "svg_ns", + "sync_test", "test_name", "test_own_props", "tests", "todo_wine", "todo_wine_if", "trace", "undefined", "unescape", "win_skip" + ], [ + "ActiveXObject", ["AesGcmEncryptResult",11], ["ANGLE_instanced_arrays",11], ["AnimationEvent",10], ["ApplicationCache",10], "Array", ["ArrayBuffer",10], "Audio", ["AudioTrack",10], + ["AudioTrackList",10], "BeforeUnloadEvent", ["Blob",10], "BookmarkCollection", "Boolean", "CanvasGradient", "CanvasPattern", "CanvasPixelArray", "CanvasRenderingContext2D", + "CDATASection", ["CloseEvent",10], "CollectGarbage", "CompositionEvent", "ControlRangeCollection", "Coordinates", ["Crypto",11], ["CryptoOperation",11], "CSSFontFaceRule", + "CSSImportRule", ["CSSKeyframeRule",10], ["CSSKeyframesRule",10], "CSSMediaRule", "CSSNamespaceRule", "CSSPageRule", "CSSRuleList", "DataTransfer", ["DataView",10], "Date", "Debug", + ["DeviceAcceleration",11], ["DeviceMotionEvent",11], ["DeviceOrientationEvent",11], ["DeviceRotationRate",11], ["DOMError",10], "DOMException", "DOMParser", + ["DOMSettableTokenList",10], ["DOMStringList",10], ["DOMStringMap",11], "DragEvent", "Enumerator", "Error", ["ErrorEvent",10], "EvalError", "EventException", + ["EXT_texture_filter_anisotropic",11], ["File",10], ["FileList",10], ["FileReader",10], ["Float32Array",10], ["Float64Array",10], "FocusEvent", ["FormData",10], "Function", + "Geolocation", ["HTMLAllCollection",11], "HTMLAppletElement", "HTMLAreasCollection", "HTMLAudioElement", "HTMLBaseElement", "HTMLBaseFontElement", "HTMLBGSoundElement", + "HTMLBlockElement", "HTMLBRElement", "HTMLCanvasElement", ["HTMLDataListElement",10], "HTMLDDElement", "HTMLDirectoryElement", "HTMLDivElement", "HTMLDListElement", "HTMLDTElement", + "HTMLFieldSetElement", "HTMLFontElement", "HTMLFrameSetElement", "HTMLHeadingElement", "HTMLHRElement", "HTMLIsIndexElement", "HTMLLegendElement", "HTMLLIElement", "HTMLMapElement", + "HTMLMarqueeElement", "HTMLMediaElement", "HTMLMenuElement", "HTMLModElement", "HTMLNextIdElement", "HTMLOListElement", "HTMLOptGroupElement", "HTMLParagraphElement", + "HTMLParamElement", "HTMLPhraseElement", "HTMLPreElement", ["HTMLProgressElement",10], "HTMLQuoteElement", "HTMLSourceElement", "HTMLSpanElement", "HTMLTableCaptionElement", + "HTMLTableColElement", "HTMLTableHeaderCellElement", "HTMLTableSectionElement", ["HTMLTrackElement",10], "HTMLUListElement", "HTMLVideoElement", ["IDBCursor",10], + ["IDBCursorWithValue",10], ["IDBDatabase",10], ["IDBFactory",10], ["IDBIndex",10], ["IDBKeyRange",10], ["IDBObjectStore",10], ["IDBOpenDBRequest",10], ["IDBRequest",10], + ["IDBTransaction",10], ["IDBVersionChangeEvent",10], "ImageData", "Infinity", ["Int16Array",10], ["Int32Array",10], ["Int8Array",10], ["Intl",11], "JSON", ["Key",11], + ["KeyOperation",11], ["KeyPair",11], "Location", ["Map",11], "Math", "MediaError", "MediaList", ["MediaSource",11], ["MessageChannel",10], ["MessagePort",10], ["MimeType",11], + ["MimeTypeArray",9,10], "MouseWheelEvent", "MSBehaviorUrnsCollection", ["MSBlobBuilder",10], "MSCompatibleInfo", "MSCompatibleInfoCollection", ["MSCSSMatrix",10], ["MSGesture",10], + ["MSGestureEvent",10], ["MSGraphicsTrust",11], ["MSInputMethodContext",11], ["MSManipulationEvent",10], ["MSMediaKeyError",11], ["MSMediaKeyMessageEvent",11], + ["MSMediaKeyNeededEvent",11], ["MSMediaKeys",11], ["MSMediaKeySession",11], "MSMimeTypesCollection", ["MSNamespaceInfo",0,9], "MSPluginsCollection", ["MSPointerEvent",10], + ["MSPopupWindow",0,10], ["MSRangeCollection",10], "MSSiteModeEvent", ["MSStream",10], ["MSStreamReader",10], "MutationEvent", ["MutationRecord",11], "NaN", "NodeFilter", + "NodeIterator", "Number", "Object", ["OES_element_index_uint",11], ["OES_standard_derivatives",11], ["OES_texture_float",11], ["OES_texture_float_linear",11], "PerformanceEntry", + "PerformanceMark", "PerformanceMeasure", ["PerformanceNavigationTiming",11], "PerformanceResourceTiming", ["Plugin",11], ["PluginArray",9,10], ["PointerEvent",11], + ["PopStateEvent",10], "Position", "PositionError", "ProcessingInstruction", "RangeError", "RangeException", "ReferenceError", "RegExp", "ScriptEngine", "ScriptEngineBuildVersion", + "ScriptEngineMajorVersion", "ScriptEngineMinorVersion", "Selection", ["Set",11], ["SourceBuffer",11], ["SourceBufferList",11], "String", "StyleMedia", "StyleSheetPageList", + ["SubtleCrypto",11], "SVGAElement", "SVGAngle", "SVGAnimatedAngle", "SVGAnimatedBoolean", "SVGAnimatedEnumeration", "SVGAnimatedInteger", "SVGAnimatedLength", "SVGAnimatedLengthList", + "SVGAnimatedNumber", "SVGAnimatedNumberList", "SVGAnimatedPreserveAspectRatio", "SVGAnimatedRect", "SVGAnimatedString", "SVGAnimatedTransformList", "SVGClipPathElement", + ["SVGComponentTransferFunctionElement",10], "SVGDefsElement", "SVGDescElement", "SVGElementInstance", "SVGElementInstanceList", "SVGEllipseElement", "SVGException", + ["SVGFEBlendElement",10], ["SVGFEColorMatrixElement",10], ["SVGFEComponentTransferElement",10], ["SVGFECompositeElement",10], ["SVGFEConvolveMatrixElement",10], + ["SVGFEDiffuseLightingElement",10], ["SVGFEDisplacementMapElement",10], ["SVGFEDistantLightElement",10], ["SVGFEFloodElement",10], ["SVGFEFuncAElement",10], ["SVGFEFuncBElement",10], + ["SVGFEFuncGElement",10], ["SVGFEFuncRElement",10], ["SVGFEGaussianBlurElement",10], ["SVGFEImageElement",10], ["SVGFEMergeElement",10], ["SVGFEMergeNodeElement",10], + ["SVGFEMorphologyElement",10], ["SVGFEOffsetElement",10], ["SVGFEPointLightElement",10], ["SVGFESpecularLightingElement",10], ["SVGFESpotLightElement",10], ["SVGFETileElement",10], + ["SVGFETurbulenceElement",10], ["SVGFilterElement",10], "SVGGElement", "SVGGradientElement", "SVGImageElement", "SVGLength", "SVGLengthList", "SVGLinearGradientElement", + "SVGLineElement", "SVGMarkerElement", "SVGMaskElement", "SVGMatrix", "SVGMetadataElement", "SVGNumber", "SVGNumberList", "SVGPathElement", "SVGPathSeg", "SVGPathSegArcAbs", + "SVGPathSegArcRel", "SVGPathSegClosePath", "SVGPathSegCurvetoCubicAbs", "SVGPathSegCurvetoCubicRel", "SVGPathSegCurvetoCubicSmoothAbs", "SVGPathSegCurvetoCubicSmoothRel", + "SVGPathSegCurvetoQuadraticAbs", "SVGPathSegCurvetoQuadraticRel", "SVGPathSegCurvetoQuadraticSmoothAbs", "SVGPathSegCurvetoQuadraticSmoothRel", "SVGPathSegLinetoAbs", + "SVGPathSegLinetoHorizontalAbs", "SVGPathSegLinetoHorizontalRel", "SVGPathSegLinetoRel", "SVGPathSegLinetoVerticalAbs", "SVGPathSegLinetoVerticalRel", "SVGPathSegList", + "SVGPathSegMovetoAbs", "SVGPathSegMovetoRel", "SVGPatternElement", "SVGPoint", "SVGPointList", "SVGPolygonElement", "SVGPolylineElement", "SVGPreserveAspectRatio", + "SVGRadialGradientElement", "SVGRect", "SVGRectElement", "SVGScriptElement", "SVGStopElement", "SVGStringList", "SVGStyleElement", "SVGSwitchElement", "SVGSymbolElement", + "SVGTextElement", "SVGTextPathElement", "SVGTitleElement", "SVGTransform", "SVGTransformList", "SVGUnitTypes", "SVGUseElement", "SVGViewElement", "SVGZoomAndPan", "SVGZoomEvent", + "SyntaxError", "TextEvent", "TextMetrics", "TextRangeCollection", ["TextTrack",10], ["TextTrackCue",10], ["TextTrackCueList",10], ["TextTrackList",10], "TimeRanges", + ["TrackEvent",10], ["TransitionEvent",10], "TreeWalker", "TypeError", ["Uint16Array",10], ["Uint32Array",10], ["Uint8Array",10], ["Uint8ClampedArray",11], "URIError", + ["URL",10], ["ValidityState",10], "VBArray", ["VideoPlaybackQuality",11], ["WeakMap",11], ["WebGLActiveInfo",11], ["WebGLBuffer",11], ["WebGLContextEvent",11], ["WebGLFramebuffer",11], + ["WebGLObject",11], ["WebGLProgram",11], ["WebGLRenderbuffer",11], ["WebGLRenderingContext",11], ["WebGLShader",11], ["WebGLShaderPrecisionFormat",11], ["WebGLTexture",11], + ["WebGLUniformLocation",11], ["WEBGL_compressed_texture_s3tc",11], ["WEBGL_debug_renderer_info",11], ["WebSocket",10], "WheelEvent", ["Worker",10], ["XDomainRequest",9,10], + ["XMLDocument",11], ["XMLHttpRequestEventTarget",10], "XMLSerializer", "async_test", "broken", "compat_version", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", + "escape", "eval", "file_prefix", "format_message", "func_scope_val", "func_scope_val2", "guard", "isFinite", "isNaN", "next_test", "ok", "pagehide_fired", "pageshow_fired", + "parseFloat", "parseInt", "ready_states", "reportSuccess", "run_tests", "svg_ns", "sync_test", "test_name", "test_own_props", "tests", "todo_wine", "todo_wine_if", "trace", + "undefined", "unescape", "win_skip" + ]); +}); + sync_test("performance timing", function() { ok(performance.timing.domInteractive >= performance.timing.domLoading, "domInteractive < domLoading"); ok(performance.timing.domContentLoadedEventStart >= performance.timing.domInteractive, "domContentLoadedEventStart < domInteractive");
From: Gabriel Ivăncescu gabrielopcode@gmail.com
Even if the props are not enumerable.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 2 +- dlls/mshtml/htmldoc.c | 2 +- dlls/mshtml/htmlstorage.c | 2 +- dlls/mshtml/htmlwindow.c | 5 +- dlls/mshtml/mshtml_private.h | 2 +- dlls/mshtml/tests/documentmode.js | 87 ++++++++++++++----------------- 6 files changed, 47 insertions(+), 53 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 90fca9f0dac..7b4bb9c92f4 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -2553,7 +2553,7 @@ HRESULT dispex_next_id(DispatchEx *dispex, DISPID id, BOOL enum_all_own_props, D }
if(dispex->info->vtbl->next_dispid) { - hres = dispex->info->vtbl->next_dispid(dispex, id, ret); + hres = dispex->info->vtbl->next_dispid(dispex, id, enum_all_own_props, ret); if(hres != S_FALSE) return hres; } diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 2fa58ccbecb..f0179ba4dbc 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5446,7 +5446,7 @@ static HRESULT HTMLDocumentNode_disp_invoke(DispatchEx *dispex, DISPID id, LCID return S_FALSE; }
-static HRESULT HTMLDocumentNode_next_dispid(DispatchEx *dispex, DISPID id, DISPID *pid) +static HRESULT HTMLDocumentNode_next_dispid(DispatchEx *dispex, DISPID id, BOOL enum_all_own_props, DISPID *pid) { DWORD idx = (id == DISPID_STARTENUM) ? 0 : id - MSHTML_DISPID_CUSTOM_MIN + 1; HTMLDocumentNode *This = impl_from_DispatchEx(dispex); diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index 337705207af..e2bc180650c 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -1179,7 +1179,7 @@ static HRESULT HTMLStorage_delete(DispatchEx *dispex, DISPID id) return HTMLStorage_removeItem(&This->IHTMLStorage_iface, This->props[idx]); }
-static HRESULT HTMLStorage_next_dispid(DispatchEx *dispex, DISPID id, DISPID *pid) +static HRESULT HTMLStorage_next_dispid(DispatchEx *dispex, DISPID id, BOOL enum_all_own_props, DISPID *pid) { DWORD idx = (id == DISPID_STARTENUM) ? 0 : id - MSHTML_DISPID_CUSTOM_MIN + 1; HTMLStorage *This = impl_from_DispatchEx(dispex); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index de31da6fa48..beda4dd3c1e 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3990,12 +3990,13 @@ static HRESULT HTMLWindow_delete(DispatchEx *dispex, DISPID id) return hres; }
-static HRESULT HTMLWindow_next_dispid(DispatchEx *dispex, DISPID id, DISPID *pid) +static HRESULT HTMLWindow_next_dispid(DispatchEx *dispex, DISPID id, BOOL enum_all_own_props, DISPID *pid) { DWORD idx = (id == DISPID_STARTENUM) ? 0 : id - MSHTML_DISPID_CUSTOM_MIN + 1; HTMLInnerWindow *This = impl_from_DispatchEx(dispex);
- while(idx < This->global_prop_cnt && This->global_props[idx].type != GLOBAL_DISPEXVAR) + while(idx < This->global_prop_cnt && This->global_props[idx].type != GLOBAL_DISPEXVAR && + (!enum_all_own_props || This->global_props[idx].type != GLOBAL_SCRIPTVAR || global_prop_still_exists(This, &This->global_props[idx]) != S_OK)) idx++; if(idx >= This->global_prop_cnt) return S_FALSE; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index e12568c72d1..f8e63c7045b 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -398,7 +398,7 @@ typedef struct { /* These are called when the object implements GetMemberName, InvokeEx, DeleteMemberByDispID and GetNextDispID for custom props */ HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); HRESULT (*delete)(DispatchEx*,DISPID); - HRESULT (*next_dispid)(DispatchEx*,DISPID,DISPID*); + HRESULT (*next_dispid)(DispatchEx*,DISPID,BOOL,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) */ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 0ec6a6b4a4f..de43911b840 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -149,54 +149,47 @@ sync_test("window own props", function() { "guard", "isFinite", "isNaN", "next_test", "ok", "pagehide_fired", "pageshow_fired", "parseFloat", "parseInt", "ready_states", "reportSuccess", "run_tests", "svg_ns", "sync_test", "test_name", "test_own_props", "tests", "todo_wine", "todo_wine_if", "trace", "undefined", "unescape", "win_skip" ], [ - "ActiveXObject", ["AesGcmEncryptResult",11], ["ANGLE_instanced_arrays",11], ["AnimationEvent",10], ["ApplicationCache",10], "Array", ["ArrayBuffer",10], "Audio", ["AudioTrack",10], - ["AudioTrackList",10], "BeforeUnloadEvent", ["Blob",10], "BookmarkCollection", "Boolean", "CanvasGradient", "CanvasPattern", "CanvasPixelArray", "CanvasRenderingContext2D", - "CDATASection", ["CloseEvent",10], "CollectGarbage", "CompositionEvent", "ControlRangeCollection", "Coordinates", ["Crypto",11], ["CryptoOperation",11], "CSSFontFaceRule", - "CSSImportRule", ["CSSKeyframeRule",10], ["CSSKeyframesRule",10], "CSSMediaRule", "CSSNamespaceRule", "CSSPageRule", "CSSRuleList", "DataTransfer", ["DataView",10], "Date", "Debug", - ["DeviceAcceleration",11], ["DeviceMotionEvent",11], ["DeviceOrientationEvent",11], ["DeviceRotationRate",11], ["DOMError",10], "DOMException", "DOMParser", - ["DOMSettableTokenList",10], ["DOMStringList",10], ["DOMStringMap",11], "DragEvent", "Enumerator", "Error", ["ErrorEvent",10], "EvalError", "EventException", - ["EXT_texture_filter_anisotropic",11], ["File",10], ["FileList",10], ["FileReader",10], ["Float32Array",10], ["Float64Array",10], "FocusEvent", ["FormData",10], "Function", - "Geolocation", ["HTMLAllCollection",11], "HTMLAppletElement", "HTMLAreasCollection", "HTMLAudioElement", "HTMLBaseElement", "HTMLBaseFontElement", "HTMLBGSoundElement", - "HTMLBlockElement", "HTMLBRElement", "HTMLCanvasElement", ["HTMLDataListElement",10], "HTMLDDElement", "HTMLDirectoryElement", "HTMLDivElement", "HTMLDListElement", "HTMLDTElement", - "HTMLFieldSetElement", "HTMLFontElement", "HTMLFrameSetElement", "HTMLHeadingElement", "HTMLHRElement", "HTMLIsIndexElement", "HTMLLegendElement", "HTMLLIElement", "HTMLMapElement", - "HTMLMarqueeElement", "HTMLMediaElement", "HTMLMenuElement", "HTMLModElement", "HTMLNextIdElement", "HTMLOListElement", "HTMLOptGroupElement", "HTMLParagraphElement", - "HTMLParamElement", "HTMLPhraseElement", "HTMLPreElement", ["HTMLProgressElement",10], "HTMLQuoteElement", "HTMLSourceElement", "HTMLSpanElement", "HTMLTableCaptionElement", - "HTMLTableColElement", "HTMLTableHeaderCellElement", "HTMLTableSectionElement", ["HTMLTrackElement",10], "HTMLUListElement", "HTMLVideoElement", ["IDBCursor",10], - ["IDBCursorWithValue",10], ["IDBDatabase",10], ["IDBFactory",10], ["IDBIndex",10], ["IDBKeyRange",10], ["IDBObjectStore",10], ["IDBOpenDBRequest",10], ["IDBRequest",10], - ["IDBTransaction",10], ["IDBVersionChangeEvent",10], "ImageData", "Infinity", ["Int16Array",10], ["Int32Array",10], ["Int8Array",10], ["Intl",11], "JSON", ["Key",11], - ["KeyOperation",11], ["KeyPair",11], "Location", ["Map",11], "Math", "MediaError", "MediaList", ["MediaSource",11], ["MessageChannel",10], ["MessagePort",10], ["MimeType",11], - ["MimeTypeArray",9,10], "MouseWheelEvent", "MSBehaviorUrnsCollection", ["MSBlobBuilder",10], "MSCompatibleInfo", "MSCompatibleInfoCollection", ["MSCSSMatrix",10], ["MSGesture",10], - ["MSGestureEvent",10], ["MSGraphicsTrust",11], ["MSInputMethodContext",11], ["MSManipulationEvent",10], ["MSMediaKeyError",11], ["MSMediaKeyMessageEvent",11], - ["MSMediaKeyNeededEvent",11], ["MSMediaKeys",11], ["MSMediaKeySession",11], "MSMimeTypesCollection", ["MSNamespaceInfo",0,9], "MSPluginsCollection", ["MSPointerEvent",10], - ["MSPopupWindow",0,10], ["MSRangeCollection",10], "MSSiteModeEvent", ["MSStream",10], ["MSStreamReader",10], "MutationEvent", ["MutationRecord",11], "NaN", "NodeFilter", - "NodeIterator", "Number", "Object", ["OES_element_index_uint",11], ["OES_standard_derivatives",11], ["OES_texture_float",11], ["OES_texture_float_linear",11], "PerformanceEntry", - "PerformanceMark", "PerformanceMeasure", ["PerformanceNavigationTiming",11], "PerformanceResourceTiming", ["Plugin",11], ["PluginArray",9,10], ["PointerEvent",11], - ["PopStateEvent",10], "Position", "PositionError", "ProcessingInstruction", "RangeError", "RangeException", "ReferenceError", "RegExp", "ScriptEngine", "ScriptEngineBuildVersion", - "ScriptEngineMajorVersion", "ScriptEngineMinorVersion", "Selection", ["Set",11], ["SourceBuffer",11], ["SourceBufferList",11], "String", "StyleMedia", "StyleSheetPageList", - ["SubtleCrypto",11], "SVGAElement", "SVGAngle", "SVGAnimatedAngle", "SVGAnimatedBoolean", "SVGAnimatedEnumeration", "SVGAnimatedInteger", "SVGAnimatedLength", "SVGAnimatedLengthList", - "SVGAnimatedNumber", "SVGAnimatedNumberList", "SVGAnimatedPreserveAspectRatio", "SVGAnimatedRect", "SVGAnimatedString", "SVGAnimatedTransformList", "SVGClipPathElement", - ["SVGComponentTransferFunctionElement",10], "SVGDefsElement", "SVGDescElement", "SVGElementInstance", "SVGElementInstanceList", "SVGEllipseElement", "SVGException", - ["SVGFEBlendElement",10], ["SVGFEColorMatrixElement",10], ["SVGFEComponentTransferElement",10], ["SVGFECompositeElement",10], ["SVGFEConvolveMatrixElement",10], - ["SVGFEDiffuseLightingElement",10], ["SVGFEDisplacementMapElement",10], ["SVGFEDistantLightElement",10], ["SVGFEFloodElement",10], ["SVGFEFuncAElement",10], ["SVGFEFuncBElement",10], - ["SVGFEFuncGElement",10], ["SVGFEFuncRElement",10], ["SVGFEGaussianBlurElement",10], ["SVGFEImageElement",10], ["SVGFEMergeElement",10], ["SVGFEMergeNodeElement",10], + ["AesGcmEncryptResult",11], ["ANGLE_instanced_arrays",11], ["AnimationEvent",10], ["ApplicationCache",10], ["ArrayBuffer",9,9], "Audio", ["AudioTrack",10], ["AudioTrackList",10], + "BeforeUnloadEvent", ["Blob",10], "BookmarkCollection", "CanvasGradient", "CanvasPattern", "CanvasPixelArray", "CanvasRenderingContext2D", "CDATASection", ["CloseEvent",10], + "CompositionEvent", "ControlRangeCollection", "Coordinates", ["Crypto",11], ["CryptoOperation",11], "CSSFontFaceRule", "CSSImportRule", ["CSSKeyframeRule",10], ["CSSKeyframesRule",10], + "CSSMediaRule", "CSSNamespaceRule", "CSSPageRule", "CSSRuleList", "DataTransfer", ["DataView",9,9], "Debug", ["DeviceAcceleration",11], ["DeviceMotionEvent",11], + ["DeviceOrientationEvent",11], ["DeviceRotationRate",11], ["DOMError",10], "DOMException", "DOMParser", ["DOMSettableTokenList",10], ["DOMStringList",10], ["DOMStringMap",11], + "DragEvent", ["ErrorEvent",10], "EventException", ["EXT_texture_filter_anisotropic",11], ["File",10], ["FileList",10], ["FileReader",10], ["Float32Array",10], ["Float64Array",10], + "FocusEvent", ["FormData",10], "Geolocation", "GetObject", ["HTMLAllCollection",11], "HTMLAppletElement", "HTMLAreasCollection", "HTMLAudioElement", "HTMLBaseElement", + "HTMLBaseFontElement", "HTMLBGSoundElement", "HTMLBlockElement", "HTMLBRElement", "HTMLCanvasElement", ["HTMLDataListElement",10], "HTMLDDElement", "HTMLDirectoryElement", + "HTMLDivElement", "HTMLDListElement", "HTMLDTElement", "HTMLFieldSetElement", "HTMLFontElement", "HTMLFrameSetElement", "HTMLHeadingElement", "HTMLHRElement", "HTMLIsIndexElement", + "HTMLLegendElement", "HTMLLIElement", "HTMLMapElement", "HTMLMarqueeElement", "HTMLMediaElement", "HTMLMenuElement", "HTMLModElement", "HTMLNextIdElement", "HTMLOListElement", + "HTMLOptGroupElement", "HTMLParagraphElement", "HTMLParamElement", "HTMLPhraseElement", "HTMLPreElement", ["HTMLProgressElement",10], "HTMLQuoteElement", "HTMLSourceElement", + "HTMLSpanElement", "HTMLTableCaptionElement", "HTMLTableColElement", "HTMLTableHeaderCellElement", "HTMLTableSectionElement", ["HTMLTrackElement",10], "HTMLUListElement", + "HTMLVideoElement", ["IDBCursor",10], ["IDBCursorWithValue",10], ["IDBDatabase",10], ["IDBFactory",10], ["IDBIndex",10], ["IDBKeyRange",10], ["IDBObjectStore",10], ["IDBOpenDBRequest",10], + ["IDBRequest",10], ["IDBTransaction",10], ["IDBVersionChangeEvent",10], "ImageData", ["Int16Array",10], ["Int32Array",10], ["Int8Array",10], ["Intl",11], ["Key",11], ["KeyOperation",11], + ["KeyPair",11], "Location", "MediaError", "MediaList", ["MediaSource",11], ["MessageChannel",10], ["MessagePort",10], ["MimeType",11], ["MimeTypeArray",9,10], "MouseWheelEvent", + "MSBehaviorUrnsCollection", ["MSBlobBuilder",10], "MSCompatibleInfo", "MSCompatibleInfoCollection", ["MSCSSMatrix",10], ["MSGesture",10], ["MSGestureEvent",10], ["MSGraphicsTrust",11], + ["MSInputMethodContext",11], ["MSManipulationEvent",10], ["MSMediaKeyError",11], ["MSMediaKeyMessageEvent",11], ["MSMediaKeyNeededEvent",11], ["MSMediaKeys",11], ["MSMediaKeySession",11], + "MSMimeTypesCollection", ["MSNamespaceInfo",0,9], "MSPluginsCollection", ["MSPointerEvent",10], ["MSPopupWindow",0,10], ["MSRangeCollection",10], "MSSiteModeEvent", ["MSStream",10], + ["MSStreamReader",10], "MutationEvent", ["MutationRecord",11], "NodeFilter", "NodeIterator", ["OES_element_index_uint",11], ["OES_standard_derivatives",11], ["OES_texture_float",11], + ["OES_texture_float_linear",11], "PerformanceEntry", "PerformanceMark", "PerformanceMeasure", ["PerformanceNavigationTiming",11], "PerformanceResourceTiming", ["Plugin",11], + ["PluginArray",9,10], ["PointerEvent",11], ["PopStateEvent",10], "Position", "PositionError", "ProcessingInstruction", "RangeException", "RegExpError", "Selection", ["SourceBuffer",11], + ["SourceBufferList",11], "StyleMedia", "StyleSheetPageList", ["SubtleCrypto",11], "SVGAElement", "SVGAngle", "SVGAnimatedAngle", "SVGAnimatedBoolean", "SVGAnimatedEnumeration", + "SVGAnimatedInteger", "SVGAnimatedLength", "SVGAnimatedLengthList", "SVGAnimatedNumber", "SVGAnimatedNumberList", "SVGAnimatedPreserveAspectRatio", "SVGAnimatedRect", "SVGAnimatedString", + "SVGAnimatedTransformList", "SVGClipPathElement", ["SVGComponentTransferFunctionElement",10], "SVGDefsElement", "SVGDescElement", "SVGElementInstance", "SVGElementInstanceList", + "SVGEllipseElement", "SVGException", ["SVGFEBlendElement",10], ["SVGFEColorMatrixElement",10], ["SVGFEComponentTransferElement",10], ["SVGFECompositeElement",10], + ["SVGFEConvolveMatrixElement",10], ["SVGFEDiffuseLightingElement",10], ["SVGFEDisplacementMapElement",10], ["SVGFEDistantLightElement",10], ["SVGFEFloodElement",10], ["SVGFEFuncAElement",10], + ["SVGFEFuncBElement",10], ["SVGFEFuncGElement",10], ["SVGFEFuncRElement",10], ["SVGFEGaussianBlurElement",10], ["SVGFEImageElement",10], ["SVGFEMergeElement",10], ["SVGFEMergeNodeElement",10], ["SVGFEMorphologyElement",10], ["SVGFEOffsetElement",10], ["SVGFEPointLightElement",10], ["SVGFESpecularLightingElement",10], ["SVGFESpotLightElement",10], ["SVGFETileElement",10], - ["SVGFETurbulenceElement",10], ["SVGFilterElement",10], "SVGGElement", "SVGGradientElement", "SVGImageElement", "SVGLength", "SVGLengthList", "SVGLinearGradientElement", - "SVGLineElement", "SVGMarkerElement", "SVGMaskElement", "SVGMatrix", "SVGMetadataElement", "SVGNumber", "SVGNumberList", "SVGPathElement", "SVGPathSeg", "SVGPathSegArcAbs", - "SVGPathSegArcRel", "SVGPathSegClosePath", "SVGPathSegCurvetoCubicAbs", "SVGPathSegCurvetoCubicRel", "SVGPathSegCurvetoCubicSmoothAbs", "SVGPathSegCurvetoCubicSmoothRel", - "SVGPathSegCurvetoQuadraticAbs", "SVGPathSegCurvetoQuadraticRel", "SVGPathSegCurvetoQuadraticSmoothAbs", "SVGPathSegCurvetoQuadraticSmoothRel", "SVGPathSegLinetoAbs", - "SVGPathSegLinetoHorizontalAbs", "SVGPathSegLinetoHorizontalRel", "SVGPathSegLinetoRel", "SVGPathSegLinetoVerticalAbs", "SVGPathSegLinetoVerticalRel", "SVGPathSegList", - "SVGPathSegMovetoAbs", "SVGPathSegMovetoRel", "SVGPatternElement", "SVGPoint", "SVGPointList", "SVGPolygonElement", "SVGPolylineElement", "SVGPreserveAspectRatio", - "SVGRadialGradientElement", "SVGRect", "SVGRectElement", "SVGScriptElement", "SVGStopElement", "SVGStringList", "SVGStyleElement", "SVGSwitchElement", "SVGSymbolElement", - "SVGTextElement", "SVGTextPathElement", "SVGTitleElement", "SVGTransform", "SVGTransformList", "SVGUnitTypes", "SVGUseElement", "SVGViewElement", "SVGZoomAndPan", "SVGZoomEvent", - "SyntaxError", "TextEvent", "TextMetrics", "TextRangeCollection", ["TextTrack",10], ["TextTrackCue",10], ["TextTrackCueList",10], ["TextTrackList",10], "TimeRanges", - ["TrackEvent",10], ["TransitionEvent",10], "TreeWalker", "TypeError", ["Uint16Array",10], ["Uint32Array",10], ["Uint8Array",10], ["Uint8ClampedArray",11], "URIError", - ["URL",10], ["ValidityState",10], "VBArray", ["VideoPlaybackQuality",11], ["WeakMap",11], ["WebGLActiveInfo",11], ["WebGLBuffer",11], ["WebGLContextEvent",11], ["WebGLFramebuffer",11], - ["WebGLObject",11], ["WebGLProgram",11], ["WebGLRenderbuffer",11], ["WebGLRenderingContext",11], ["WebGLShader",11], ["WebGLShaderPrecisionFormat",11], ["WebGLTexture",11], - ["WebGLUniformLocation",11], ["WEBGL_compressed_texture_s3tc",11], ["WEBGL_debug_renderer_info",11], ["WebSocket",10], "WheelEvent", ["Worker",10], ["XDomainRequest",9,10], - ["XMLDocument",11], ["XMLHttpRequestEventTarget",10], "XMLSerializer", "async_test", "broken", "compat_version", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", - "escape", "eval", "file_prefix", "format_message", "func_scope_val", "func_scope_val2", "guard", "isFinite", "isNaN", "next_test", "ok", "pagehide_fired", "pageshow_fired", - "parseFloat", "parseInt", "ready_states", "reportSuccess", "run_tests", "svg_ns", "sync_test", "test_name", "test_own_props", "tests", "todo_wine", "todo_wine_if", "trace", - "undefined", "unescape", "win_skip" + ["SVGFETurbulenceElement",10], ["SVGFilterElement",10], "SVGGElement", "SVGGradientElement", "SVGImageElement", "SVGLength", "SVGLengthList", "SVGLinearGradientElement", "SVGLineElement", + "SVGMarkerElement", "SVGMaskElement", "SVGMatrix", "SVGMetadataElement", "SVGNumber", "SVGNumberList", "SVGPathElement", "SVGPathSeg", "SVGPathSegArcAbs", "SVGPathSegArcRel", + "SVGPathSegClosePath", "SVGPathSegCurvetoCubicAbs", "SVGPathSegCurvetoCubicRel", "SVGPathSegCurvetoCubicSmoothAbs", "SVGPathSegCurvetoCubicSmoothRel", "SVGPathSegCurvetoQuadraticAbs", + "SVGPathSegCurvetoQuadraticRel", "SVGPathSegCurvetoQuadraticSmoothAbs", "SVGPathSegCurvetoQuadraticSmoothRel", "SVGPathSegLinetoAbs", "SVGPathSegLinetoHorizontalAbs", + "SVGPathSegLinetoHorizontalRel", "SVGPathSegLinetoRel", "SVGPathSegLinetoVerticalAbs", "SVGPathSegLinetoVerticalRel", "SVGPathSegList", "SVGPathSegMovetoAbs", "SVGPathSegMovetoRel", + "SVGPatternElement", "SVGPoint", "SVGPointList", "SVGPolygonElement", "SVGPolylineElement", "SVGPreserveAspectRatio", "SVGRadialGradientElement", "SVGRect", "SVGRectElement", + "SVGScriptElement", "SVGStopElement", "SVGStringList", "SVGStyleElement", "SVGSwitchElement", "SVGSymbolElement", "SVGTextElement", "SVGTextPathElement", "SVGTitleElement", + "SVGTransform", "SVGTransformList", "SVGUnitTypes", "SVGUseElement", "SVGViewElement", "SVGZoomAndPan", "SVGZoomEvent", "TextEvent", "TextMetrics", "TextRangeCollection", ["TextTrack",10], + ["TextTrackCue",10], ["TextTrackCueList",10], ["TextTrackList",10], "TimeRanges", ["TrackEvent",10], ["TransitionEvent",10], "TreeWalker", ["Uint16Array",10], ["Uint32Array",10], + ["Uint8Array",10], ["Uint8ClampedArray",11], ["URL",10], ["ValidityState",10], ["VideoPlaybackQuality",11], ["WebGLActiveInfo",11], ["WebGLBuffer",11], ["WebGLContextEvent",11], + ["WebGLFramebuffer",11], ["WebGLObject",11], ["WebGLProgram",11], ["WebGLRenderbuffer",11], ["WebGLRenderingContext",11], ["WebGLShader",11], ["WebGLShaderPrecisionFormat",11], + ["WebGLTexture",11], ["WebGLUniformLocation",11], ["WEBGL_compressed_texture_s3tc",11], ["WEBGL_debug_renderer_info",11], ["WebSocket",10], "WheelEvent", ["Worker",10], + ["XDomainRequest",9,10], ["XMLDocument",11], ["XMLHttpRequestEventTarget",10], "XMLSerializer" ]); });
From: Gabriel Ivăncescu gabrielopcode@gmail.com
fdexEnumAll is useless.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 22 +++++++++++++++++++ dlls/jscript/jscript.c | 7 ++++++ dlls/jscript/jscript.h | 1 + dlls/jscript/jsdisp.idl | 1 + dlls/jscript/tests/run.c | 44 ++++++++++++++++++++++++++++++++++++++ dlls/mshtml/htmlwindow.c | 4 ++++ dlls/mshtml/tests/script.c | 25 +++++++++++++++++++++- 7 files changed, 103 insertions(+), 1 deletion(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 110c021b6b8..3b475237970 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -3632,3 +3632,25 @@ IWineJSDispatchHost *get_host_dispatch(IDispatch *disp) IWineJSDispatchHost_GetOuterDispatch(host_obj->host_iface, &ret); return ret; } + +HRESULT fill_globals(script_ctx_t *ctx, IWineJSDispatchHost *script_global) +{ + jsdisp_t *global = ctx->global; + DISPID id = DISPID_STARTENUM; + struct property_info desc; + HRESULT hres; + + for(;;) { + hres = jsdisp_next_prop(global, id, JSDISP_ENUM_OWN, &id); + if(hres == S_FALSE) + break; + if(FAILED(hres)) + return hres; + + hres = IWineJSDispatchHost_LookupProperty(script_global, get_prop(global, id)->name, fdexNameCaseSensitive, &desc); + if(FAILED(hres)) + return hres; + } + + return S_OK; +} diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index 9a74d010ab5..a7f468a677a 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -1465,12 +1465,19 @@ static HRESULT WINAPI WineJScript_InitHostConstructor(IWineJScript *iface, IWine return init_host_constructor(This->ctx, constr, method_name, ret); }
+static HRESULT WINAPI WineJScript_FillGlobals(IWineJScript *iface, IWineJSDispatchHost *script_global) +{ + JScript *This = impl_from_IWineJScript(iface); + return fill_globals(This->ctx, script_global); +} + static const IWineJScriptVtbl WineJScriptVtbl = { WineJScript_QueryInterface, WineJScript_AddRef, WineJScript_Release, WineJScript_InitHostObject, WineJScript_InitHostConstructor, + WineJScript_FillGlobals, };
HRESULT create_jscript_object(BOOL is_encode, REFIID riid, void **ppv) diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 4f21cae941b..a3009239ba1 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -243,6 +243,7 @@ HRESULT init_dispex(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*); HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,jsdisp_t*); HRESULT init_host_object(script_ctx_t*,IWineJSDispatchHost*,IWineJSDispatch*,UINT32,IWineJSDispatch**); HRESULT init_host_constructor(script_ctx_t*,IWineJSDispatchHost*,const WCHAR*,IWineJSDispatch**); +HRESULT fill_globals(script_ctx_t*,IWineJSDispatchHost*);
HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,unsigned,jsval_t*,jsval_t*); HRESULT disp_call_name(script_ctx_t*,IDispatch*,const WCHAR*,WORD,unsigned,jsval_t*,jsval_t*); diff --git a/dlls/jscript/jsdisp.idl b/dlls/jscript/jsdisp.idl index a96214a98b6..2eaadf44f94 100644 --- a/dlls/jscript/jsdisp.idl +++ b/dlls/jscript/jsdisp.idl @@ -86,4 +86,5 @@ interface IWineJScript : IUnknown { HRESULT InitHostObject(IWineJSDispatchHost *host_obj, IWineJSDispatch *prototype, UINT32 flags, IWineJSDispatch **ret); HRESULT InitHostConstructor(IWineJSDispatchHost *constr, const WCHAR *method_name, IWineJSDispatch **ret); + HRESULT FillGlobals(IWineJSDispatchHost *script_global); } diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 106fd8c99d4..5d555b05eb0 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -3720,6 +3720,49 @@ static void test_members(void) IActiveScript_Release(script); }
+static void test_enum(void) +{ + DISPID id = DISPID_STARTENUM; + IActiveScriptParse *parser; + IActiveScript *engine; + IDispatchEx *dispex; + IDispatch *disp; + HRESULT hres; + + engine = create_script(); + + hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser); + ok(hres == S_OK, "Could not get IActiveScriptParse: %08lx\n", hres); + + hres = IActiveScriptParse_InitNew(parser); + ok(hres == S_OK, "InitNew failed: %08lx\n", hres); + IActiveScriptParse_Release(parser); + + hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite); + ok(hres == S_OK, "SetScriptSite failed: %08lx\n", hres); + + hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08lx\n", hres); + + hres = IActiveScript_GetScriptDispatch(engine, NULL, &disp); + ok(hres == S_OK, "GetScriptDispatch failed: %08lx\n", hres); + ok(disp != NULL, "script disp == NULL\n"); + + hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08lx\n", hres); + IDispatch_Release(disp); + + hres = IDispatchEx_GetNextDispID(dispex, 0, id, &id); + ok(hres == S_FALSE, "GetNextDispID returned: %08lx\n", hres); + + id = DISPID_STARTENUM; + hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id); + ok(hres == S_FALSE, "GetNextDispID returned: %08lx\n", hres); + + IDispatchEx_Release(dispex); + close_script(engine); +} + static void test_destructors(void) { static const WCHAR cyclic_refs[] = L"(function() {\n" @@ -4379,6 +4422,7 @@ static BOOL run_tests(void) test_script_exprs(); test_invokeex(); test_members(); + test_enum(); test_destructors(); test_eval(); test_error_reports(); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index bc4964f8b3f..de31da6fa48 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4053,6 +4053,10 @@ static HRESULT HTMLWindow_fill_props(DispatchEx *dispex) This->static_props_filled = TRUE; }
+ hres = IWineJScript_FillGlobals(This->jscript, &This->event_target.dispex.IWineJSDispatchHost_iface); + if(FAILED(hres)) + return hres; + return S_FALSE; }
diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index f454de86711..2c0c907a9f4 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -319,11 +319,15 @@ fail:
static void test_sp_caller(IServiceProvider *sp) { + BOOL seen_doc, seen_undefined; IOleCommandTarget *cmdtarget; IServiceProvider *caller; IHTMLWindow2 *window; + IDispatchEx *dispex; HRESULT hres; VARIANT var; + DISPID id; + BSTR str;
hres = IServiceProvider_QueryService(sp, &SID_GetCaller, &IID_IServiceProvider, (void**)&caller); ok(hres == S_OK, "QueryService(SID_GetCaller) returned: %08lx\n", hres); @@ -343,8 +347,27 @@ static void test_sp_caller(IServiceProvider *sp) hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLWindow2, (void**)&window); ok(hres == S_OK, "QueryInterface(IHTMLWindow2) failed: %08lx\n", hres); ok(window != NULL, "window is NULL\n"); - IHTMLWindow2_Release(window); VariantClear(&var); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IDispatchEx, (void**)&dispex); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08lx\n", hres); + IHTMLWindow2_Release(window); + + for(id = DISPID_STARTENUM, seen_doc = FALSE, seen_undefined = FALSE;;) { + hres = IDispatchEx_GetNextDispID(dispex, fdexEnumAll, id, &id); + if(hres == S_FALSE) break; + ok(hres == S_OK, "GetNextDispID failed: %08lx\n", hres); + + hres = IDispatchEx_GetMemberName(dispex, id, &str); + ok(hres == S_OK, "GetMemberName failed: %08lx\n", hres); + if(!wcscmp(str, L"document")) seen_doc = TRUE; + if(!wcscmp(str, L"undefined")) seen_undefined = TRUE; + SysFreeString(str); + } + ok(seen_doc, "document was not enumerated from window\n"); + ok(!seen_undefined, "undefined was enumerated from window\n"); + + IDispatchEx_Release(dispex); }
static void test_script_vars(unsigned argc, VARIANTARG *argv)
Jacek Caban (@jacek) commented about dlls/mshtml/tests/documentmode.js:
"SVGLineElement", "SVGMarkerElement", "SVGMaskElement", "SVGMatrix", "SVGMetadataElement", "SVGNumber", "SVGNumberList", "SVGPathElement", "SVGPathSeg", "SVGPathSegArcAbs",
"SVGPathSegArcRel", "SVGPathSegClosePath", "SVGPathSegCurvetoCubicAbs", "SVGPathSegCurvetoCubicRel", "SVGPathSegCurvetoCubicSmoothAbs", "SVGPathSegCurvetoCubicSmoothRel",
"SVGPathSegCurvetoQuadraticAbs", "SVGPathSegCurvetoQuadraticRel", "SVGPathSegCurvetoQuadraticSmoothAbs", "SVGPathSegCurvetoQuadraticSmoothRel", "SVGPathSegLinetoAbs",
"SVGPathSegLinetoHorizontalAbs", "SVGPathSegLinetoHorizontalRel", "SVGPathSegLinetoRel", "SVGPathSegLinetoVerticalAbs", "SVGPathSegLinetoVerticalRel", "SVGPathSegList",
"SVGPathSegMovetoAbs", "SVGPathSegMovetoRel", "SVGPatternElement", "SVGPoint", "SVGPointList", "SVGPolygonElement", "SVGPolylineElement", "SVGPreserveAspectRatio",
"SVGRadialGradientElement", "SVGRect", "SVGRectElement", "SVGScriptElement", "SVGStopElement", "SVGStringList", "SVGStyleElement", "SVGSwitchElement", "SVGSymbolElement",
"SVGTextElement", "SVGTextPathElement", "SVGTitleElement", "SVGTransform", "SVGTransformList", "SVGUnitTypes", "SVGUseElement", "SVGViewElement", "SVGZoomAndPan", "SVGZoomEvent",
"SyntaxError", "TextEvent", "TextMetrics", "TextRangeCollection", ["TextTrack",10], ["TextTrackCue",10], ["TextTrackCueList",10], ["TextTrackList",10], "TimeRanges",
["TrackEvent",10], ["TransitionEvent",10], "TreeWalker", "TypeError", ["Uint16Array",10], ["Uint32Array",10], ["Uint8Array",10], ["Uint8ClampedArray",11], "URIError",
["URL",10], ["ValidityState",10], "VBArray", ["VideoPlaybackQuality",11], ["WeakMap",11], ["WebGLActiveInfo",11], ["WebGLBuffer",11], ["WebGLContextEvent",11], ["WebGLFramebuffer",11],
["WebGLObject",11], ["WebGLProgram",11], ["WebGLRenderbuffer",11], ["WebGLRenderingContext",11], ["WebGLShader",11], ["WebGLShaderPrecisionFormat",11], ["WebGLTexture",11],
["WebGLUniformLocation",11], ["WEBGL_compressed_texture_s3tc",11], ["WEBGL_debug_renderer_info",11], ["WebSocket",10], "WheelEvent", ["Worker",10], ["XDomainRequest",9,10],
["XMLDocument",11], ["XMLHttpRequestEventTarget",10], "XMLSerializer", "async_test", "broken", "compat_version", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent",
"escape", "eval", "file_prefix", "format_message", "func_scope_val", "func_scope_val2", "guard", "isFinite", "isNaN", "next_test", "ok", "pagehide_fired", "pageshow_fired",
"parseFloat", "parseInt", "ready_states", "reportSuccess", "run_tests", "svg_ns", "sync_test", "test_name", "test_own_props", "tests", "todo_wine", "todo_wine_if", "trace",
"undefined", "unescape", "win_skip"
As it would need an update every time we add a global variable, this seems annoying to maintain. Could we use a window of an empty iframe instead? Maybe insert a `<script>` element into it to add some global variable that way.
Jacek Caban (@jacek) commented about dlls/mshtml/mshtml_private.h:
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*);
This seems weird to have both this and `next_dispid`. Is the plan to replace it entirely? Otherwise, why not do the filling in `next_dispid(DISPID_STARTENUM)` instead?
Also, I think you're missing some volatile objects, AFAIR some containers with indexed properties have mutable length. For sake of this commit, you could probably just check if the object has `next_dispid`. For a more precise distinction, we could have a flag in the object descriptor.
On Thu May 8 20:46:55 2025 +0000, Jacek Caban wrote:
This seems weird to have both this and `next_dispid`. Is the plan to replace it entirely? Otherwise, why not do the filling in `next_dispid(DISPID_STARTENUM)` instead? Also, I think you're missing some volatile objects, AFAIR some containers with indexed properties have mutable length. For sake of this commit, you could probably just check if the object has `next_dispid`. For a more precise distinction, we could have a flag in the object descriptor.
I was a bit stuck with the idea that `next_dispid` was for enumerations, even though I pass the bool at the end of the MR…
Anyway I've been trying to simplify this to use that and avoid `fill_props` on mshtml but there's some things I have to mention. You're right that there's other objects that are volatile (most of the indexed ones), but those are volatile in a different sense; their external props are volatile, but their fill is not, because they never fill those props (I mean, they aren't filled in this MR and shouldn't be, but even if theoretically they would be filled, it doesn't break if we don't flag them as such now, because we never fill them currently, so it wouldn't be a regression at all).
Later on I will add tests for them of course but the thing is their indexed props are "special" and use the overriding mechanism. They aren't returned by getOwnPropertyNames either and so shouldn't be filled. Anyway I'll keep them out of this MR since that will require way more changes…