mshtml: Forward deletion for GLOBAL_SCRIPTVAR to the script's object.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2024-11-13 19:32:44 +02:00 committed by Alexandre Julliard
parent 9b264c948f
commit 38f1ce3210
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 39 additions and 3 deletions

View file

@ -3974,6 +3974,44 @@ HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags,
return hres; return hres;
} }
static HRESULT HTMLWindow_delete(DispatchEx *dispex, DISPID id)
{
HTMLInnerWindow *This = impl_from_DispatchEx(dispex);
DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN;
global_prop_t *prop;
HRESULT hres = S_OK;
if(idx >= This->global_prop_cnt)
return DISP_E_MEMBERNOTFOUND;
prop = This->global_props + idx;
switch(prop->type) {
case GLOBAL_SCRIPTVAR: {
IDispatchEx *iface;
IDispatch *disp;
disp = get_script_disp(prop->script_host);
if(!disp)
return E_UNEXPECTED;
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&iface);
if(SUCCEEDED(hres)) {
hres = IDispatchEx_DeleteMemberByDispID(iface, prop->id);
IDispatchEx_Release(iface);
}else {
WARN("No IDispatchEx, so can't delete\n");
hres = S_OK;
}
IDispatch_Release(disp);
break;
}
default:
break;
}
return hres;
}
static HRESULT HTMLWindow_next_dispid(DispatchEx *dispex, DISPID id, DISPID *pid) static HRESULT HTMLWindow_next_dispid(DispatchEx *dispex, DISPID id, DISPID *pid)
{ {
DWORD idx = (id == DISPID_STARTENUM) ? 0 : id - MSHTML_DISPID_CUSTOM_MIN + 1; DWORD idx = (id == DISPID_STARTENUM) ? 0 : id - MSHTML_DISPID_CUSTOM_MIN + 1;
@ -4200,6 +4238,7 @@ static const event_target_vtbl_t HTMLWindow_event_target_vtbl = {
.lookup_dispid = HTMLWindow_lookup_dispid, .lookup_dispid = HTMLWindow_lookup_dispid,
.find_dispid = HTMLWindow_find_dispid, .find_dispid = HTMLWindow_find_dispid,
.invoke = HTMLWindow_invoke, .invoke = HTMLWindow_invoke,
.delete = HTMLWindow_delete,
.next_dispid = HTMLWindow_next_dispid, .next_dispid = HTMLWindow_next_dispid,
.get_prop_desc = HTMLWindow_get_prop_desc, .get_prop_desc = HTMLWindow_get_prop_desc,
.get_script_global = HTMLWindow_get_script_global, .get_script_global = HTMLWindow_get_script_global,

View file

@ -1386,7 +1386,6 @@ sync_test("delete_prop", function() {
r = (delete window.encodeURIComponent); r = (delete window.encodeURIComponent);
ok(v >= 9, "did not get an expect exception deleting encodeURIComponent"); ok(v >= 9, "did not get an expect exception deleting encodeURIComponent");
ok(r, "delete returned " + r); ok(r, "delete returned " + r);
todo_wine.
ok(!("encodeURIComponent" in obj), "encodeURIComponent is still in obj"); ok(!("encodeURIComponent" in obj), "encodeURIComponent is still in obj");
window.encodeURIComponent = prop; window.encodeURIComponent = prop;
}catch(ex) { }catch(ex) {
@ -1424,7 +1423,6 @@ sync_test("delete_prop", function() {
ok(r, "did not get an expected globalprop2 exception"); ok(r, "did not get an expected globalprop2 exception");
}else { }else {
ok(!r, "got an unexpected exception"); ok(!r, "got an unexpected exception");
todo_wine.
ok(!("globalprop2" in obj), "globalprop2 is still in obj"); ok(!("globalprop2" in obj), "globalprop2 is still in obj");
} }
@ -1457,7 +1455,6 @@ sync_test("delete_prop", function() {
r = (delete window.globalprop5); r = (delete window.globalprop5);
ok(v >= 9, "did not get an expected exception deleting globalprop5"); ok(v >= 9, "did not get an expected exception deleting globalprop5");
ok(r, "delete returned " + r); ok(r, "delete returned " + r);
todo_wine.
ok(!("globalprop5" in obj), "globalprop5 is still in obj"); ok(!("globalprop5" in obj), "globalprop5 is still in obj");
}catch(ex) { }catch(ex) {
ok(v < 9, "expected exception deleting globalprop5"); ok(v < 9, "expected exception deleting globalprop5");