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 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)
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=115157
Your paranoid android.
=== debian11 (32 bit report) ===
mshtml: script.c:644: Test failed: L"/index.html?dom.js:storage: Got exception "
=== debian11 (32 bit Chinese:China report) ===
mshtml: script.c:644: Test failed: L"/index.html?dom.js:storage: Got exception "
=== debian11 (32 bit WoW report) ===
mshtml: script.c:644: Test failed: L"/index.html?dom.js:storage: Got exception "
=== debian11 (64 bit WoW report) ===
mshtml: script.c:644: Test failed: L"/index.html?dom.js:storage: Got exception "