Module: wine Branch: master Commit: 0db9f33b7df9ea089fab8080c3a0309165c0a9a9 URL: https://gitlab.winehq.org/wine/wine/-/commit/0db9f33b7df9ea089fab8080c3a0309...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Tue May 30 19:44:13 2023 +0300
mshtml: Handle protocols with no ports when checking target origin.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/mshtml/htmlwindow.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 6c550172d68..c6072c7e9fa 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3161,6 +3161,7 @@ static HRESULT WINAPI window_private_matchMedia(IWineHTMLWindowPrivate *iface, B
static HRESULT check_target_origin(HTMLInnerWindow *window, const WCHAR *target_origin) { + BOOL no_port = FALSE; IUri *uri, *target; DWORD port, port2; BSTR bstr, bstr2; @@ -3219,11 +3220,20 @@ static HRESULT check_target_origin(HTMLInnerWindow *window, const WCHAR *target_ goto done;
hres = IUri_GetPort(uri, &port); - if(hres != S_OK) - goto done; + if(hres != S_OK) { + if(FAILED(hres)) + goto done; + no_port = TRUE; /* some protocols don't have ports (e.g. res) */ + } hres = IUri_GetPort(target, &port2); - if(hres == S_OK && port != port2) + if(hres != S_OK) { + if(FAILED(hres)) + goto done; + if(no_port) + hres = S_OK; + }else if(no_port || port != port2) { hres = S_FALSE; + }
done: IUri_Release(target);