diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 1dd18fcc2ee..4e40cdf1bea 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2388,7 +2388,19 @@ static void WINAPI WineJSDispatch_Free(IWineJSDispatch *iface) { jsdisp_t *This = impl_from_IWineJSDispatch(iface); jsdisp_free(This); - } +} + +static HRESULT WINAPI WineJSDispatch_GetPropertyFlags(IWineJSDispatch *iface, DISPID id, UINT32 *ret) +{ + jsdisp_t *This = impl_from_IWineJSDispatch(iface); + dispex_prop_t *prop = get_prop(This, id); + + if(!prop || prop->type == PROP_DELETED || prop->type == PROP_PROTREF) + return DISP_E_MEMBERNOTFOUND; + + *ret = prop->flags & PROPF_PUBLIC_MASK; + return S_OK; +} static HRESULT WINAPI WineJSDispatch_GetScriptGlobal(IWineJSDispatch *iface, IWineJSDispatchHost **ret) { @@ -2422,6 +2434,7 @@ static IWineJSDispatchVtbl DispatchExVtbl = { DispatchEx_GetNextDispID, DispatchEx_GetNameSpaceParent, WineJSDispatch_Free, + WineJSDispatch_GetPropertyFlags, WineJSDispatch_GetScriptGlobal, }; diff --git a/dlls/jscript/jsdisp.idl b/dlls/jscript/jsdisp.idl index 051f819e817..5f1384bce78 100644 --- a/dlls/jscript/jsdisp.idl +++ b/dlls/jscript/jsdisp.idl @@ -51,6 +51,7 @@ interface IWineJSDispatchHost; interface IWineJSDispatch : IDispatchEx { void Free(); + HRESULT GetPropertyFlags(DISPID id, UINT32 *ret); HRESULT GetScriptGlobal(IWineJSDispatchHost **ret); } diff --git a/dlls/mshtml/htmlscript.h b/dlls/mshtml/htmlscript.h index 30b46677395..c1b1aa2c4bc 100644 --- a/dlls/mshtml/htmlscript.h +++ b/dlls/mshtml/htmlscript.h @@ -50,5 +50,6 @@ void update_browser_script_mode(GeckoBrowser*,IUri*); BOOL find_global_prop(HTMLInnerWindow*,const WCHAR*,DWORD,ScriptHost**,DISPID*); HRESULT global_prop_still_exists(HTMLInnerWindow*,global_prop_t*); IDispatch *get_script_disp(ScriptHost*); +IWineJSDispatch *get_script_jsdisp(ScriptHost*); IActiveScriptSite *get_first_script_site(HTMLInnerWindow*); void initialize_script_global(HTMLInnerWindow*); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index b6f66627dd9..3624c128cca 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4029,7 +4029,9 @@ static HRESULT HTMLWindow_next_dispid(DispatchEx *dispex, DISPID id, DISPID *pid HRESULT HTMLWindow_get_prop_desc(DispatchEx *dispex, DISPID id, struct property_info *desc) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); + IWineJSDispatch *jsdisp; global_prop_t *prop; + HRESULT hres = S_OK; if(id - MSHTML_DISPID_CUSTOM_MIN >= This->global_prop_cnt) return DISP_E_MEMBERNOTFOUND; @@ -4038,10 +4040,22 @@ HRESULT HTMLWindow_get_prop_desc(DispatchEx *dispex, DISPID id, struct property_ desc->name = prop->name; desc->id = id; desc->flags = PROPF_WRITABLE | PROPF_CONFIGURABLE; - if(prop->type == GLOBAL_DISPEXVAR) - desc->flags |= PROPF_ENUMERABLE; desc->iid = 0; - return S_OK; + + switch(prop->type) { + case GLOBAL_SCRIPTVAR: { + if((jsdisp = get_script_jsdisp(prop->script_host))) + hres = IWineJSDispatch_GetPropertyFlags(jsdisp, prop->id, &desc->flags); + break; + } + case GLOBAL_DISPEXVAR: + desc->flags |= PROPF_ENUMERABLE; + break; + default: + break; + } + + return hres; } static HTMLInnerWindow *HTMLWindow_get_script_global(DispatchEx *dispex) diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index 73bb8e1d5c6..3ad1da8cf3c 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -85,7 +85,7 @@ struct ScriptHost { SCRIPTSTATE script_state; HTMLInnerWindow *window; - IDispatchEx *script_dispex; + IWineJSDispatch *script_jsdisp; GUID guid; struct list entry; @@ -264,7 +264,7 @@ static BOOL init_script_engine(ScriptHost *script_host, IActiveScript *script) if(FAILED(hres)) WARN("GetScriptDispatch failed: %08lx\n", hres); else { - IDispatch_QueryInterface(script_disp, &IID_IDispatchEx, (void**)&script_host->script_dispex); + IDispatch_QueryInterface(script_disp, &IID_IWineJSDispatch, (void**)&script_host->script_jsdisp); IDispatch_Release(script_disp); } } @@ -301,8 +301,8 @@ static void release_script_engine(ScriptHost *This) unlink_ref(&This->parse); } - if(This->script_dispex) - IDispatchEx_Release(This->script_dispex); + if(This->script_jsdisp) + IWineJSDispatch_Release(This->script_jsdisp); IActiveScript_Release(This->script); This->script = NULL; This->script_state = SCRIPTSTATE_UNINITIALIZED; @@ -1588,6 +1588,11 @@ IDispatch *get_script_disp(ScriptHost *script_host) return disp; } +IWineJSDispatch *get_script_jsdisp(ScriptHost *script_host) +{ + return script_host->script_jsdisp; +} + IActiveScriptSite *get_first_script_site(HTMLInnerWindow *window) { if(list_empty(&window->script_hosts)) { @@ -1850,9 +1855,9 @@ HRESULT global_prop_still_exists(HTMLInnerWindow *window, global_prop_t *prop) if(!prop->script_host->script) return E_UNEXPECTED; - if(!prop->script_host->script_dispex) + if(!prop->script_host->script_jsdisp) return S_OK; - return IDispatchEx_GetMemberProperties(prop->script_host->script_dispex, prop->id, 0, &properties); + return IWineJSDispatch_GetMemberProperties(prop->script_host->script_jsdisp, prop->id, 0, &properties); } case GLOBAL_ELEMENTVAR: { IHTMLElement *elem; diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 9d6a4eb8418..0033a06fa3c 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2251,10 +2251,8 @@ sync_test("globals override", function() { for(i = 0; i < builtins.length; i++) { desc = Object.getOwnPropertyDescriptor(window, builtins[i]); ok(desc !== undefined, "getOwnPropertyDescriptor('" + builtins[i] + "' returned undefined"); - todo_wine. ok(desc.configurable === false, builtins[i] + " is configurable"); ok(desc.enumerable === false, builtins[i] + " is enumerable"); - todo_wine. ok(desc.writable === false, builtins[i] + " is writable"); } });