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

mshtml: Return proper errors when navigating with no browser.

parent 110dad9c
......@@ -2832,7 +2832,7 @@ static HRESULT WINAPI HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow *iface,
FIXME("unimplemented flags %lx\n", flags & ~2);
if(!window || !window->browser)
return E_UNEXPECTED;
return E_FAIL;
if(window->browser->doc->hostui) {
hres = IDocHostUIHandler_TranslateUrl(window->browser->doc->hostui, 0, url, &translated_url);
......
......@@ -2679,6 +2679,9 @@ HRESULT navigate_url(HTMLOuterWindow *window, const WCHAR *new_url, IUri *base_u
BSTR display_uri;
HRESULT hres;
if(!window->browser)
return E_UNEXPECTED;
if(new_url && base_uri)
hres = CoInternetCombineUrlEx(base_uri, new_url, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
&nav_uri, 0);
......
......@@ -6003,12 +6003,13 @@ static void test_document_close(void)
{
IHTMLPrivateWindow *priv_window;
IHTMLDocument2 *doc, *doc_node;
IHTMLLocation *location;
IHTMLDocument3 *doc3;
IHTMLElement *elem;
DWORD cookie;
BSTR bstr, bstr2;
HRESULT hres;
VARIANT v;
BSTR bstr;
LONG ref;
MSG msg;
......@@ -6091,6 +6092,24 @@ static void test_document_close(void)
IHTMLDocument2_Release(doc_node);
IHTMLDocument2_Release(doc);
bstr = SysAllocString(L"about:blank");
hres = IHTMLWindow2_get_location(window, &location);
ok(hres == S_OK, "get_location failed: %08lx\n", hres);
hres = IHTMLLocation_put_href(location, bstr);
ok(hres == E_UNEXPECTED || broken(hres == E_ABORT), "put_href returned: %08lx\n", hres);
IHTMLLocation_Release(location);
V_VT(&v) = VT_EMPTY;
bstr2 = SysAllocString(L"");
hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLPrivateWindow, (void**)&priv_window);
ok(hres == S_OK, "Could not get IHTMLPrivateWindow) interface: %08lx\n", hres);
hres = IHTMLPrivateWindow_SuperNavigate(priv_window, bstr, bstr2, NULL, NULL, &v, &v, 0);
ok(hres == E_FAIL, "SuperNavigate returned: %08lx\n", hres);
IHTMLPrivateWindow_Release(priv_window);
SysFreeString(bstr2);
SysFreeString(bstr);
IHTMLWindow2_Release(window);
window = NULL;
......
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