Commit f8bb1d7e authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement deleting props for Storage.

parent e28cc104
......@@ -1763,15 +1763,12 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR nam
TRACE("(%p)->(%s %lx)\n", This, debugstr_w(name), grfdex);
if(dispex_compat_mode(This) < COMPAT_MODE_IE8) {
/* Not implemented by IE */
return E_NOTIMPL;
}
hres = IDispatchEx_GetDispID(&This->IDispatchEx_iface, name, grfdex & ~fdexNameEnsure, &id);
if(FAILED(hres)) {
compat_mode_t compat_mode = dispex_compat_mode(This);
TRACE("property %s not found\n", debugstr_w(name));
return dispex_compat_mode(This) < COMPAT_MODE_IE9 ? hres : S_OK;
return compat_mode < COMPAT_MODE_IE8 ? E_NOTIMPL :
compat_mode < COMPAT_MODE_IE9 ? hres : S_OK;
}
return IDispatchEx_DeleteMemberByDispID(&This->IDispatchEx_iface, id);
......@@ -1783,6 +1780,9 @@ static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID
TRACE("(%p)->(%lx)\n", This, id);
if(is_custom_dispid(id) && This->info->desc->vtbl && This->info->desc->vtbl->delete)
return This->info->desc->vtbl->delete(This, id);
if(dispex_compat_mode(This) < COMPAT_MODE_IE8) {
/* Not implemented by IE */
return E_NOTIMPL;
......
......@@ -5921,6 +5921,7 @@ static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = {
NULL,
NULL,
HTMLDocumentNode_invoke,
NULL,
HTMLDocumentNode_get_compat_mode,
NULL
},
......
......@@ -7183,6 +7183,7 @@ static event_target_vtbl_t HTMLElement_event_target_vtbl = {
HTMLElement_get_dispid,
HTMLElement_invoke,
NULL,
NULL,
HTMLElement_populate_props
},
HTMLElement_get_gecko_target,
......
......@@ -985,10 +985,25 @@ static HRESULT HTMLStorage_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
return S_OK;
}
static HRESULT HTMLStorage_delete(DispatchEx *dispex, DISPID id)
{
HTMLStorage *This = impl_from_DispatchEx(dispex);
DWORD idx = id - MSHTML_DISPID_CUSTOM_MIN;
if(idx >= This->num_props)
return DISP_E_MEMBERNOTFOUND;
if(dispex_compat_mode(dispex) < COMPAT_MODE_IE8)
return MSHTML_E_INVALID_ACTION;
return HTMLStorage_removeItem(&This->IHTMLStorage_iface, This->props[idx]);
}
static const dispex_static_data_vtbl_t HTMLStorage_dispex_vtbl = {
NULL,
HTMLStorage_get_dispid,
HTMLStorage_invoke,
HTMLStorage_delete,
NULL
};
......
......@@ -3954,6 +3954,7 @@ static const event_target_vtbl_t HTMLWindow_event_target_vtbl = {
NULL,
NULL,
HTMLWindow_invoke,
NULL,
HTMLWindow_get_compat_mode,
NULL
},
......
......@@ -72,7 +72,8 @@
#define NSAPI WINAPI
#define MSHTML_E_NODOC 0x800a025c
#define MSHTML_E_INVALID_ACTION 0x800a01bd
#define MSHTML_E_NODOC 0x800a025c
typedef struct HTMLDOMNode HTMLDOMNode;
typedef struct ConnectionPoint ConnectionPoint;
......@@ -333,6 +334,7 @@ typedef struct {
HRESULT (*value)(DispatchEx*,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
HRESULT (*get_dispid)(DispatchEx*,BSTR,DWORD,DISPID*);
HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*);
HRESULT (*delete)(DispatchEx*,DISPID);
compat_mode_t (*get_compat_mode)(DispatchEx*);
HRESULT (*populate_props)(DispatchEx*);
} dispex_static_data_vtbl_t;
......
......@@ -1201,6 +1201,31 @@ sync_test("map_obj", function() {
ok(r === 1, "r = " + r);
});
sync_test("storage", function() {
var v = document.documentMode, r;
sessionStorage.setItem("foobar", "1234");
ok("foobar" in sessionStorage, "foobar not in sessionStorage");
r = sessionStorage.foobar;
ok(r === "1234", "sessionStorage.foobar = " + r);
sessionStorage.barfoo = 4321;
r = sessionStorage.getItem("barfoo");
ok(r === "4321", "sessionStorage.barfoo = " + r);
try {
delete sessionStorage.foobar;
ok(v >= 8, "expected exception deleting sessionStorage.foobar");
ok(!("foobar" in sessionStorage), "foobar in sessionStorage after deletion");
r = sessionStorage.getItem("foobar");
ok(r === null, "sessionStorage.foobar after deletion = " + r);
}catch(e) {
ok(v < 8, "did not expect exception deleting sessionStorage.foobar");
ok(e.number === 0xa01bd - 0x80000000, "deleting sessionStorage.foobar threw = " + e.number);
}
sessionStorage.clear();
});
sync_test("elem_attr", function() {
var v = document.documentMode;
var elem = document.createElement("div"), r;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment