mshtml: Use actual referenced prop flags for window script props.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2024-11-18 22:49:52 +02:00 committed by Alexandre Julliard
parent c4630993fb
commit 67c1c3c255
Notes: Alexandre Julliard 2024-11-18 23:19:10 +01:00
Approved-by: Jacek Caban (@jacek)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6678
6 changed files with 44 additions and 12 deletions

View file

@ -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,
};

View file

@ -51,6 +51,7 @@ interface IWineJSDispatchHost;
interface IWineJSDispatch : IDispatchEx
{
void Free();
HRESULT GetPropertyFlags(DISPID id, UINT32 *ret);
HRESULT GetScriptGlobal(IWineJSDispatchHost **ret);
}

View file

@ -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*);

View file

@ -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)

View file

@ -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;

View file

@ -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");
}
});