mshtml: Override window's element prop directly rather than using GLOBAL_DISPEXVAR.

When GLOBAL_DISPEXVAR is used, we store the id of the dynamic prop and
invoke it using the same id. But this is not the case if we have a jsdisp,
which is redirected from InvokeEx and results in an invalid id.

The actual way this works on native (in IE9+) is that element/frame props
are special and not part of the window object at all. They're actually
looked up after the prototype is, in a special way, but that requires a
revamp. Storing over it just creates an actual prop on the window (which
is what we are doing here).

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2024-11-13 19:32:43 +02:00 committed by Alexandre Julliard
parent 18aefb5dcf
commit 055bf9f5a2
Notes: Alexandre Julliard 2024-11-14 23:12:21 +01:00
Approved-by: Jacek Caban (@jacek)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6721
2 changed files with 10 additions and 1 deletions

View file

@ -656,7 +656,13 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val)
TRACE("no prop_put\n");
return S_OK;
}
return This->builtin_info->prop_put(This, prop->u.id, val);
hres = This->builtin_info->prop_put(This, prop->u.id, val);
if(hres != S_FALSE)
return hres;
prop->type = PROP_JSVAL;
prop->flags = PROPF_ENUMERABLE | PROPF_CONFIGURABLE | PROPF_WRITABLE;
prop->u.val = jsval_undefined();
break;
default:
ERR("type %d\n", prop->type);
return E_FAIL;

View file

@ -3926,6 +3926,9 @@ HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags,
case DISPATCH_PROPERTYPUT: {
DISPID dispex_id;
if(This->event_target.dispex.jsdisp)
return S_FALSE;
hres = dispex_get_dynid(&This->event_target.dispex, prop->name, TRUE, &dispex_id);
if(FAILED(hres))
return hres;