From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/jscript/dispex.c | 12 +++++++++++- dlls/jscript/jsdisp.idl | 1 + dlls/mshtml/htmlwindow.c | 27 +++++++++++++++++++++++++-- dlls/mshtml/tests/es5.js | 2 -- 4 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 1dd18fcc2ee..8274862541c 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -2388,7 +2388,16 @@ static void WINAPI WineJSDispatch_Free(IWineJSDispatch *iface) { jsdisp_t *This = impl_from_IWineJSDispatch(iface); jsdisp_free(This); - } +} + +static DWORD WINAPI WineJSDispatch_GetPropFlags(IWineJSDispatch *iface, DISPID id) +{ + jsdisp_t *This = impl_from_IWineJSDispatch(iface); + dispex_prop_t *prop = get_prop(This, id); + + assert(prop != NULL); + return prop->flags & PROPF_PUBLIC_MASK; +}
static HRESULT WINAPI WineJSDispatch_GetScriptGlobal(IWineJSDispatch *iface, IWineJSDispatchHost **ret) { @@ -2422,6 +2431,7 @@ static IWineJSDispatchVtbl DispatchExVtbl = { DispatchEx_GetNextDispID, DispatchEx_GetNameSpaceParent, WineJSDispatch_Free, + WineJSDispatch_GetPropFlags, WineJSDispatch_GetScriptGlobal, };
diff --git a/dlls/jscript/jsdisp.idl b/dlls/jscript/jsdisp.idl index 051f819e817..eceb9886f77 100644 --- a/dlls/jscript/jsdisp.idl +++ b/dlls/jscript/jsdisp.idl @@ -51,6 +51,7 @@ interface IWineJSDispatchHost; interface IWineJSDispatch : IDispatchEx { void Free(); + DWORD GetPropFlags(DISPID id); HRESULT GetScriptGlobal(IWineJSDispatchHost **ret); }
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index b6f66627dd9..07c16074ea8 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -4030,6 +4030,7 @@ HRESULT HTMLWindow_get_prop_desc(DispatchEx *dispex, DISPID id, struct property_ { HTMLInnerWindow *This = impl_from_DispatchEx(dispex); global_prop_t *prop; + HRESULT hres;
if(id - MSHTML_DISPID_CUSTOM_MIN >= This->global_prop_cnt) return DISP_E_MEMBERNOTFOUND; @@ -4038,9 +4039,31 @@ 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; + + switch(prop->type) { + case GLOBAL_SCRIPTVAR: { + IWineJSDispatch *jsdisp; + IDispatch *disp; + + if(!(disp = get_script_disp(prop->script_host))) + return E_UNEXPECTED; + + hres = IDispatch_QueryInterface(disp, &IID_IWineJSDispatch, (void**)&jsdisp); + IDispatch_Release(disp); + if(SUCCEEDED(hres)) { + desc->flags = IWineJSDispatch_GetPropFlags(jsdisp, prop->id); + IWineJSDispatch_Release(jsdisp); + } + break; + } + case GLOBAL_DISPEXVAR: + desc->flags |= PROPF_ENUMERABLE; + break; + default: + break; + } + return S_OK; }
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"); } });