Commit b75ed039 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Handle S_FALSE from IUri methods in the NSAPI interfaces.

Mostly by setting such strings to NULL, because the component does not exist. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent e5fe3bc0
......@@ -168,6 +168,11 @@ static nsresult return_wstr_nsacstr(nsACString *ret_str, const WCHAR *str, int l
TRACE("returning %s\n", debugstr_wn(str, len));
if(!str) {
nsACString_SetData(ret_str, NULL);
return NS_OK;
}
if(!*str) {
nsACString_SetData(ret_str, "");
return NS_OK;
......@@ -1255,10 +1260,10 @@ static nsresult NSAPI nsChannel_SetReferrerWithPolicy(nsIHttpChannel *iface, nsI
return NS_ERROR_UNEXPECTED;
}
if(!ensure_uri(This->uri) || FAILED(IUri_GetScheme(This->uri->uri, &channel_scheme)))
if(!ensure_uri(This->uri) || IUri_GetScheme(This->uri->uri, &channel_scheme) != S_OK)
channel_scheme = INTERNET_SCHEME_UNKNOWN;
if(FAILED(IUri_GetScheme(referrer->uri, &referrer_scheme)))
if(IUri_GetScheme(referrer->uri, &referrer_scheme) != S_OK)
referrer_scheme = INTERNET_SCHEME_UNKNOWN;
if(referrer_scheme == INTERNET_SCHEME_HTTPS && channel_scheme != INTERNET_SCHEME_HTTPS) {
......@@ -2291,9 +2296,9 @@ static nsresult get_uri_string(nsWineURI *This, Uri_PROPERTY prop, nsACString *r
return NS_ERROR_UNEXPECTED;
}
vala = heap_strdupWtoU(val);
vala = heap_strdupWtoU(hres == S_OK ? val : NULL);
SysFreeString(val);
if(!vala)
if(hres == S_OK && !vala)
return NS_ERROR_OUT_OF_MEMORY;
TRACE("ret %s\n", debugstr_a(vala));
......@@ -2652,7 +2657,7 @@ static nsresult NSAPI nsURI_SetPassword(nsIFileURL *iface, const nsACString *aPa
static nsresult NSAPI nsURI_GetHostPort(nsIFileURL *iface, nsACString *aHostPort)
{
nsWineURI *This = impl_from_nsIFileURL(iface);
const WCHAR *ptr;
const WCHAR *ptr = NULL;
char *vala;
BSTR val;
HRESULT hres;
......@@ -2668,13 +2673,14 @@ static nsresult NSAPI nsURI_GetHostPort(nsIFileURL *iface, nsACString *aHostPort
return NS_ERROR_UNEXPECTED;
}
ptr = wcschr(val, '@');
if(!ptr)
ptr = val;
if(hres == S_OK) {
ptr = wcschr(val, '@');
if(!ptr)
ptr = val;
}
vala = heap_strdupWtoU(ptr);
SysFreeString(val);
if(!vala)
if(hres == S_OK && !vala)
return NS_ERROR_OUT_OF_MEMORY;
TRACE("ret %s\n", debugstr_a(vala));
......@@ -2846,8 +2852,12 @@ static nsresult NSAPI nsURI_SchemeIs(nsIFileURL *iface, const char *scheme, cpp_
if(FAILED(hres))
return NS_ERROR_UNEXPECTED;
MultiByteToWideChar(CP_UTF8, 0, scheme, -1, buf, ARRAY_SIZE(buf));
*_retval = !wcscmp(scheme_name, buf);
if(hres != S_OK)
*_retval = FALSE;
else {
MultiByteToWideChar(CP_UTF8, 0, scheme, -1, buf, ARRAY_SIZE(buf));
*_retval = !wcscmp(scheme_name, buf);
}
SysFreeString(scheme_name);
return NS_OK;
}
......@@ -3167,6 +3177,11 @@ static nsresult get_uri_path(nsWineURI *This, BSTR *path, const WCHAR **file, co
hres = IUri_GetPath(This->uri, path);
if(FAILED(hres))
return NS_ERROR_FAILURE;
if(hres != S_OK) {
SysFreeString(*path);
*ext = *file = *path = NULL;
return NS_OK;
}
for(ptr = *path + SysStringLen(*path)-1; ptr > *path && *ptr != '/' && *ptr != '\\'; ptr--);
if(*ptr == '/' || *ptr == '\\')
......@@ -3458,7 +3473,7 @@ static nsresult create_nsuri(IUri *iuri, nsWineURI **_retval)
ret->uri = iuri;
hres = IUri_GetScheme(iuri, &ret->scheme);
if(FAILED(hres))
if(hres != S_OK)
ret->scheme = URL_SCHEME_UNKNOWN;
TRACE("retval=%p\n", ret);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment