[PATCH 3/5] mshtml: Implement HTMLStorage_removeItem().
Hans Leidekker
hans at codeweavers.com
Fri May 20 03:15:25 CDT 2022
Signed-off-by: Hans Leidekker <hans at 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 c19eecaf684..993d3f5b207 100644
--- a/dlls/mshtml/htmlstorage.c
+++ b/dlls/mshtml/htmlstorage.c
@@ -505,11 +505,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)
--
2.30.2
More information about the wine-devel
mailing list