Commit 679591ff authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added support for relative URLs in navigate_url.

parent 7cb41811
...@@ -154,12 +154,12 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v) ...@@ -154,12 +154,12 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v)); TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->window || !This->window->doc) { if(!This->window) {
FIXME("No document available\n"); FIXME("No window available\n");
return E_FAIL; return E_FAIL;
} }
return navigate_url(This->window->doc, v); return navigate_url(This->window, v, This->window->url);
} }
static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p) static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
......
...@@ -668,7 +668,7 @@ BOOL install_wine_gecko(BOOL); ...@@ -668,7 +668,7 @@ BOOL install_wine_gecko(BOOL);
HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*); HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD); HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
HRESULT navigate_url(HTMLDocumentNode*,OLECHAR*); HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
void call_property_onchanged(ConnectionPoint*,DISPID); void call_property_onchanged(ConnectionPoint*,DISPID);
HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*); HRESULT call_set_active_object(IOleInPlaceUIWindow*,IOleInPlaceActiveObject*);
......
...@@ -27,9 +27,12 @@ ...@@ -27,9 +27,12 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winuser.h" #include "winuser.h"
#include "winreg.h"
#include "ole2.h" #include "ole2.h"
#include "hlguids.h" #include "hlguids.h"
#include "shlguid.h" #include "shlguid.h"
#include "wininet.h"
#include "shlwapi.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h" #include "wine/unicode.h"
...@@ -41,8 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); ...@@ -41,8 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define CONTENT_LENGTH "Content-Length" #define CONTENT_LENGTH "Content-Length"
#define UTF16_STR "utf-16" #define UTF16_STR "utf-16"
static WCHAR emptyW[] = {0};
typedef struct { typedef struct {
const nsIInputStreamVtbl *lpInputStreamVtbl; const nsIInputStreamVtbl *lpInputStreamVtbl;
...@@ -1231,30 +1232,39 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url, ...@@ -1231,30 +1232,39 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url,
return hres; return hres;
} }
HRESULT navigate_url(HTMLDocumentNode *doc, OLECHAR *url)
HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base_url)
{ {
OLECHAR *translated_url = NULL; WCHAR url[INTERNET_MAX_URL_LENGTH];
HRESULT hres; HRESULT hres;
if(!url) if(!new_url) {
url = emptyW; *url = 0;
}else if(base_url) {
DWORD len = 0;
if(doc->basedoc.doc_obj->hostui) { hres = CoInternetCombineUrl(base_url, new_url, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
hres = IDocHostUIHandler_TranslateUrl(doc->basedoc.doc_obj->hostui, 0, url, url, sizeof(url)/sizeof(WCHAR), &len, 0);
&translated_url); if(FAILED(hres))
if(hres == S_OK) return hres;
url = translated_url; }else {
strcpyW(url, new_url);
} }
if(doc != doc->basedoc.doc_obj->basedoc.doc_node) { if(window->doc_obj && window->doc_obj->hostui) {
FIXME("navigation in frame\n"); OLECHAR *translated_url = NULL;
return E_NOTIMPL;
hres = IDocHostUIHandler_TranslateUrl(window->doc_obj->hostui, 0, url,
&translated_url);
if(hres == S_OK) {
strcpyW(url, translated_url);
CoTaskMemFree(translated_url);
}
} }
hres = hlink_frame_navigate(&doc->basedoc, url, NULL, 0); hres = hlink_frame_navigate(&window->doc->basedoc, url, NULL, 0);
if(FAILED(hres)) if(FAILED(hres))
FIXME("hlink_frame_navigate failed: %08x\n", hres); FIXME("hlink_frame_navigate failed: %08x\n", hres);
CoTaskMemFree(translated_url);
return hres; return hres;
} }
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