Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/mshtml/htmlstorage.c | 59 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlstorage.c b/dlls/mshtml/htmlstorage.c index b01247db56b..502eb8c25ab 100644 --- a/dlls/mshtml/htmlstorage.c +++ b/dlls/mshtml/htmlstorage.c @@ -506,11 +506,66 @@ static HRESULT WINAPI HTMLStorage_setItem(IHTMLStorage *iface, BSTR bstrKey, BST return hres; }
+static HRESULT remove_item(BSTR hostname, BSTR key) +{ + struct storage *storage; + IXMLDOMNode *root = NULL, *node = NULL; + BSTR query = NULL; + HRESULT hres; + + hres = open_storage(hostname, &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); + +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; + BSTR hostname; + HRESULT hres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(bstrKey)); + + if(!This->window) { + FIXME("session storage not supported\n"); + return E_NOTIMPL; + } + + hres = IUri_GetHost(This->window->base.outer_window->uri, &hostname); + if(hres != S_OK) + return hres; + + hres = remove_item(hostname, bstrKey); + SysFreeString(hostname); + return hres; }
static HRESULT WINAPI HTMLStorage_clear(IHTMLStorage *iface)