Module: wine Branch: master Commit: 196f13c174e4c1e97021a7ab2c918c42adabdeea URL: https://gitlab.winehq.org/wine/wine/-/commit/196f13c174e4c1e97021a7ab2c918c4...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Tue Aug 23 17:31:21 2022 +0300
mshtml: Handle S_FALSE from IUri methods in Anchor Elements.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/mshtml/htmlanchor.c | 9 +++++++++ dlls/mshtml/tests/dom.c | 6 ++++++ 2 files changed, 15 insertions(+)
diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index cfe49ac05bd..813d4eb3b2d 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -517,6 +517,10 @@ static HRESULT WINAPI HTMLAnchorElement_get_port(IHTMLAnchorElement *iface, BSTR IUri_Release(uri); if(FAILED(hres)) return hres; + if(hres != S_OK) { + *p = NULL; + return S_OK; + }
len = swprintf(buf, ARRAY_SIZE(buf), L"%u", port); str = SysAllocStringLen(buf, len); @@ -556,6 +560,11 @@ static HRESULT WINAPI HTMLAnchorElement_get_protocol(IHTMLAnchorElement *iface, IUri_Release(uri); if(FAILED(hres)) return hres; + if(hres != S_OK) { + SysFreeString(scheme); + *p = NULL; + return S_OK; + }
len = SysStringLen(scheme); if(len) { diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 5e135aa88ff..6f4e8ed007b 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -9479,6 +9479,12 @@ static void test_elems(IHTMLDocument2 *doc) test_anchor_hostname((IUnknown*)elem, L"test1"); test_anchor_port((IUnknown*)elem, L"8080");
+ /* about:blank */ + test_anchor_put_href((IUnknown*)elem, L"about:blank"); + test_anchor_href((IUnknown*)elem, L"about:blank"); + test_anchor_hostname((IUnknown*)elem, NULL); + test_anchor_port((IUnknown*)elem, NULL); + /* Restore the href */ test_anchor_put_href((IUnknown*)elem, L"http://test/"); test_anchor_href((IUnknown*)elem, L"http://test/");