mshtml: Throw invalid action for IE8 window prop deletion.

Instead of E_NOTIMPL.

We can't use the dispex's delete because it also applies to dynamic and
builtin props and it also happens too late when deleting by name (after
looking it up), where existing tests show it doesn't look up the dispid
at all.

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 12755eeb1c
commit 5947a66f4c
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 34 additions and 4 deletions

View file

@ -3364,18 +3364,34 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IWineJSDispatchHost *iface, DISPID i
static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IWineJSDispatchHost *iface, BSTR bstrName, DWORD grfdex)
{
HTMLOuterWindow *This = impl_from_IWineJSDispatchHost(iface);
compat_mode_t compat_mode = dispex_compat_mode(&This->base.inner_window->event_target.dispex);
TRACE("(%p)->(%s %lx)\n", This, debugstr_w(bstrName), grfdex);
if(compat_mode < COMPAT_MODE_IE8) {
/* Not implemented by IE */
return E_NOTIMPL;
}
if(compat_mode == COMPAT_MODE_IE8)
return MSHTML_E_INVALID_ACTION;
return IWineJSDispatchHost_DeleteMemberByName(&This->base.inner_window->event_target.dispex.IWineJSDispatchHost_iface, bstrName, grfdex);
}
static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IWineJSDispatchHost *iface, DISPID id)
{
HTMLOuterWindow *This = impl_from_IWineJSDispatchHost(iface);
compat_mode_t compat_mode = dispex_compat_mode(&This->base.inner_window->event_target.dispex);
TRACE("(%p)->(%lx)\n", This, id);
if(compat_mode < COMPAT_MODE_IE8) {
/* Not implemented by IE */
return E_NOTIMPL;
}
if(compat_mode == COMPAT_MODE_IE8)
return MSHTML_E_INVALID_ACTION;
return IWineJSDispatchHost_DeleteMemberByDispID(&This->base.inner_window->event_target.dispex.IWineJSDispatchHost_iface, id);
}

View file

@ -1380,16 +1380,31 @@ sync_test("delete_prop", function() {
/* test window object and its global scope handling */
obj = window;
ok("encodeURIComponent" in obj, "encodeURIComponent not in obj");
try {
prop = window.encodeURIComponent;
r = (delete window.encodeURIComponent);
ok(v >= 9, "did not get an expect exception deleting encodeURIComponent");
ok(r, "delete returned " + r);
todo_wine.
ok(!("encodeURIComponent" in obj), "encodeURIComponent is still in obj");
window.encodeURIComponent = prop;
}catch(ex) {
ok(v < 9, "expected exception deleting encodeURIComponent");
ok(ex.number === 0xa01bd - 0x80000000, "deleting encodeURIComponent threw " + ex.number);
ok("encodeURIComponent" in obj, "encodeURIComponent is not in obj");
}
obj.globalprop1 = true;
ok(globalprop1, "globalprop1 = " + globalprop1);
r = false;
try {
delete obj.globalprop1;
}catch(ex) {
ok(ex.number === 0xa01bd - 0x80000000, "deleting globalprop1 threw " + ex.number);
r = true;
}
if(v < 9) {
todo_wine.
ok(r, "did not get an expected exception");
}else {
ok(!r, "got an unexpected globalprop1 exception");
@ -1402,10 +1417,10 @@ sync_test("delete_prop", function() {
try {
delete obj.globalprop2;
}catch(ex) {
ok(ex.number === 0xa01bd - 0x80000000, "deleting globalprop2 threw " + ex.number);
r = true;
}
if(v < 9) {
todo_wine.
ok(r, "did not get an expected globalprop2 exception");
}else {
ok(!r, "got an unexpected exception");
@ -1419,12 +1434,11 @@ sync_test("delete_prop", function() {
try {
delete globalprop3;
}catch(ex) {
ok(ex.number === 0xa01bd - 0x80000000, "deleting globalprop3 threw " + ex.number);
r = true;
}
if(v < 9) {
todo_wine.
ok(r, "did not get an expected exception");
todo_wine.
ok("globalprop3" in obj, "globalprop3 is not in obj");
}else {
ok(!r, "got an unexpected globalprop3 exception");