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