Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/mshtml/htmlstorage.c | 51 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index 107ae7ad720..b68cd11ae64 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -484,11 +484,58 @@ static HRESULT WINAPI HTMLStorage_setItem(IHTMLStorage *iface, BSTR bstrKey, BST return set_item(This->filename, bstrKey, bstrValue); }
+static HRESULT remove_item(const WCHAR *filename, BSTR key) +{ + struct storage *storage; + IXMLDOMNode *root = NULL, *node = NULL; + BSTR query = NULL; + HRESULT hres; + + hres = open_storage(filename, &storage); + if(hres != S_OK) + return hres; + + hres = get_root_node(storage->doc, &root); + if(hres != S_OK) + goto done; + + query = build_query(key); + if(!query) { + hres = E_OUTOFMEMORY; + goto done; + } + + hres = IXMLDOMNode_selectSingleNode(root, query, &node); + if(hres == S_OK) { + hres = IXMLDOMNode_removeChild(root, node, NULL); + if(hres != S_OK) + goto done; + } + + hres = save_storage(storage, filename); + +done: + SysFreeString(query); + if(root) + IXMLDOMNode_Release(root); + if(node) + IXMLDOMNode_Release(node); + close_storage(storage); + return hres; +} + static HRESULT WINAPI HTMLStorage_removeItem(IHTMLStorage *iface, BSTR bstrKey) { HTMLStorage *This = impl_from_IHTMLStorage(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(bstrKey)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(bstrKey)); + + if(!This->filename) { + FIXME("session storage not supported\n"); + return E_NOTIMPL; + } + + return remove_item(This->filename, bstrKey); }
static HRESULT WINAPI HTMLStorage_clear(IHTMLStorage *iface)