Commit ba1db4c1 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use nsWineURL structure directly in load_nsuri.

parent 61121cef
...@@ -701,12 +701,12 @@ void release_nsio(void); ...@@ -701,12 +701,12 @@ void release_nsio(void);
BOOL install_wine_gecko(BOOL); BOOL install_wine_gecko(BOOL);
HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*); HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsIWineURI**); HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsWineURI**);
HRESULT load_nsuri(HTMLWindow*,nsWineURI*,nsChannelBSC*,DWORD);
HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD); HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*); HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);
HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*); HRESULT set_frame_doc(HTMLFrameBase*,nsIDOMDocument*);
HRESULT load_nsuri(HTMLWindow*,nsIWineURI*,DWORD);
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*);
......
...@@ -1253,39 +1253,10 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url, ...@@ -1253,39 +1253,10 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url,
return hres; return hres;
} }
HRESULT load_nsuri(HTMLWindow *window, nsIWineURI *uri, DWORD flags)
{
nsIWebNavigation *web_navigation;
nsIDocShell *doc_shell;
nsresult nsres;
nsres = get_nsinterface((nsISupports*)window->nswindow, &IID_nsIWebNavigation, (void**)&web_navigation);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIWebNavigation interface: %08x\n", nsres);
return E_FAIL;
}
nsres = nsIWebNavigation_QueryInterface(web_navigation, &IID_nsIDocShell, (void**)&doc_shell);
nsIWebNavigation_Release(web_navigation);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDocShell: %08x\n", nsres);
return E_FAIL;
}
nsres = nsIDocShell_LoadURI(doc_shell, (nsIURI*)uri, NULL, flags, FALSE);
nsIDocShell_Release(doc_shell);
if(NS_FAILED(nsres)) {
WARN("LoadURI failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base_url) HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base_url)
{ {
WCHAR url[INTERNET_MAX_URL_LENGTH]; WCHAR url[INTERNET_MAX_URL_LENGTH];
nsIWineURI *uri; nsWineURI *uri;
HRESULT hres; HRESULT hres;
if(!new_url) { if(!new_url) {
...@@ -1323,7 +1294,7 @@ HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base ...@@ -1323,7 +1294,7 @@ HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
hres = load_nsuri(window, uri, LOAD_FLAGS_NONE); hres = load_nsuri(window, uri, NULL, LOAD_FLAGS_NONE);
nsIWineURI_Release(uri); nsISupports_Release((nsISupports*)uri);
return hres; return hres;
} }
...@@ -67,7 +67,7 @@ struct nsWineURI { ...@@ -67,7 +67,7 @@ struct nsWineURI {
#define NSURI(x) ((nsIURI*) &(x)->lpWineURIVtbl) #define NSURI(x) ((nsIURI*) &(x)->lpWineURIVtbl)
#define NSWINEURI(x) ((nsIWineURI*) &(x)->lpWineURIVtbl) #define NSWINEURI(x) ((nsIWineURI*) &(x)->lpWineURIVtbl)
static nsresult create_uri(nsIURI*,HTMLWindow*,NSContainer*,nsIWineURI**); static nsresult create_uri(nsIURI*,HTMLWindow*,NSContainer*,nsWineURI**);
static const char *debugstr_nsacstr(const nsACString *nsstr) static const char *debugstr_nsacstr(const nsACString *nsstr)
{ {
...@@ -150,6 +150,38 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container) ...@@ -150,6 +150,38 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
return hres != S_OK; return hres != S_OK;
} }
HRESULT load_nsuri(HTMLWindow *window, nsWineURI *uri, nsChannelBSC *channelbsc, DWORD flags)
{
nsIWebNavigation *web_navigation;
nsIDocShell *doc_shell;
nsresult nsres;
nsres = get_nsinterface((nsISupports*)window->nswindow, &IID_nsIWebNavigation, (void**)&web_navigation);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIWebNavigation interface: %08x\n", nsres);
return E_FAIL;
}
nsres = nsIWebNavigation_QueryInterface(web_navigation, &IID_nsIDocShell, (void**)&doc_shell);
nsIWebNavigation_Release(web_navigation);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDocShell: %08x\n", nsres);
return E_FAIL;
}
uri->channel_bsc = channelbsc;
nsres = nsIDocShell_LoadURI(doc_shell, NSURI(uri), NULL, flags, FALSE);
uri->channel_bsc = NULL;
nsIDocShell_Release(doc_shell);
if(NS_FAILED(nsres)) {
WARN("LoadURI failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static BOOL translate_url(HTMLDocumentObj *doc, nsWineURI *uri) static BOOL translate_url(HTMLDocumentObj *doc, nsWineURI *uri)
{ {
OLECHAR *new_url = NULL, *url; OLECHAR *new_url = NULL, *url;
...@@ -200,6 +232,7 @@ nsresult on_start_uri_open(NSContainer *nscontainer, nsIURI *uri, PRBool *_retva ...@@ -200,6 +232,7 @@ nsresult on_start_uri_open(NSContainer *nscontainer, nsIURI *uri, PRBool *_retva
nsIURI_Release(NSURI(wine_uri)); nsIURI_Release(NSURI(wine_uri));
return NS_OK; return NS_OK;
} }
HRESULT set_wine_url(nsWineURI *This, LPCWSTR url) HRESULT set_wine_url(nsWineURI *This, LPCWSTR url)
{ {
nsIWineURI_SetWineURL(NSWINEURI(This), url); nsIWineURI_SetWineURL(NSWINEURI(This), url);
...@@ -1654,7 +1687,7 @@ static nsresult NSAPI nsURI_Clone(nsIWineURI *iface, nsIURI **_retval) ...@@ -1654,7 +1687,7 @@ static nsresult NSAPI nsURI_Clone(nsIWineURI *iface, nsIURI **_retval)
{ {
nsWineURI *This = NSURI_THIS(iface); nsWineURI *This = NSURI_THIS(iface);
nsIURI *nsuri = NULL; nsIURI *nsuri = NULL;
nsIWineURI *wine_uri; nsWineURI *wine_uri;
nsresult nsres; nsresult nsres;
TRACE("(%p)->(%p)\n", This, _retval); TRACE("(%p)->(%p)\n", This, _retval);
...@@ -1673,8 +1706,8 @@ static nsresult NSAPI nsURI_Clone(nsIWineURI *iface, nsIURI **_retval) ...@@ -1673,8 +1706,8 @@ static nsresult NSAPI nsURI_Clone(nsIWineURI *iface, nsIURI **_retval)
return nsres; return nsres;
} }
*_retval = (nsIURI*)wine_uri; *_retval = NSURI(wine_uri);
return nsIWineURI_SetWineURL(wine_uri, This->wine_url); return nsIWineURI_SetWineURL(NSWINEURI(wine_uri), This->wine_url);
} }
static nsresult NSAPI nsURI_Resolve(nsIWineURI *iface, const nsACString *arelativePath, static nsresult NSAPI nsURI_Resolve(nsIWineURI *iface, const nsACString *arelativePath,
...@@ -2239,7 +2272,7 @@ static const nsIWineURIVtbl nsWineURIVtbl = { ...@@ -2239,7 +2272,7 @@ static const nsIWineURIVtbl nsWineURIVtbl = {
nsURI_SetWineURL nsURI_SetWineURL
}; };
static nsresult create_uri(nsIURI *uri, HTMLWindow *window, NSContainer *container, nsIWineURI **_retval) static nsresult create_uri(nsIURI *uri, HTMLWindow *window, NSContainer *container, nsWineURI **_retval)
{ {
nsWineURI *ret = heap_alloc_zero(sizeof(nsWineURI)); nsWineURI *ret = heap_alloc_zero(sizeof(nsWineURI));
...@@ -2256,21 +2289,21 @@ static nsresult create_uri(nsIURI *uri, HTMLWindow *window, NSContainer *contain ...@@ -2256,21 +2289,21 @@ static nsresult create_uri(nsIURI *uri, HTMLWindow *window, NSContainer *contain
ret->nsurl = NULL; ret->nsurl = NULL;
TRACE("retval=%p\n", ret); TRACE("retval=%p\n", ret);
*_retval = NSWINEURI(ret); *_retval = ret;
return NS_OK; return NS_OK;
} }
HRESULT create_doc_uri(HTMLWindow *window, WCHAR *url, nsIWineURI **ret) HRESULT create_doc_uri(HTMLWindow *window, WCHAR *url, nsWineURI **ret)
{ {
nsIWineURI *uri; nsWineURI *uri;
nsresult nsres; nsresult nsres;
nsres = create_uri(NULL, window, window->doc_obj->nscontainer, &uri); nsres = create_uri(NULL, window, window->doc_obj->nscontainer, &uri);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
nsIWineURI_SetWineURL(uri, url); nsIWineURI_SetWineURL(NSWINEURI(uri), url);
nsIWineURI_SetIsDocumentURI(uri, TRUE); uri->is_doc_uri = TRUE;
*ret = uri; *ret = uri;
return S_OK; return S_OK;
...@@ -2504,7 +2537,8 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString * ...@@ -2504,7 +2537,8 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *
HTMLWindow *window = NULL; HTMLWindow *window = NULL;
nsIURI *uri = NULL; nsIURI *uri = NULL;
LPCWSTR base_wine_url = NULL; LPCWSTR base_wine_url = NULL;
nsIWineURI *base_wine_uri = NULL, *wine_uri; nsIWineURI *base_wine_uri = NULL;
nsWineURI *wine_uri;
BOOL is_wine_uri = FALSE; BOOL is_wine_uri = FALSE;
nsresult nsres; nsresult nsres;
...@@ -2558,14 +2592,14 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString * ...@@ -2558,14 +2592,14 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *
URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
url, sizeof(url)/sizeof(WCHAR), &len, 0); url, sizeof(url)/sizeof(WCHAR), &len, 0);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
nsIWineURI_SetWineURL(wine_uri, url); set_wine_url(wine_uri, url);
else else
WARN("CoCombineUrl failed: %08x\n", hres); WARN("CoCombineUrl failed: %08x\n", hres);
}else if(is_wine_uri) { }else if(is_wine_uri) {
WCHAR url[INTERNET_MAX_URL_LENGTH]; WCHAR url[INTERNET_MAX_URL_LENGTH];
MultiByteToWideChar(CP_ACP, 0, spec, -1, url, sizeof(url)/sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, spec, -1, url, sizeof(url)/sizeof(WCHAR));
nsIWineURI_SetWineURL(wine_uri, url); set_wine_url(wine_uri, url);
} }
if(base_wine_uri) if(base_wine_uri)
......
...@@ -172,7 +172,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO ...@@ -172,7 +172,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
LPOLESTR url = NULL; LPOLESTR url = NULL;
docobj_task_t *task; docobj_task_t *task;
download_proc_task_t *download_task; download_proc_task_t *download_task;
nsIWineURI *nsuri; nsWineURI *nsuri;
HRESULT hres; HRESULT hres;
if(pibc) { if(pibc) {
...@@ -261,9 +261,8 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO ...@@ -261,9 +261,8 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
bscallback = create_channelbsc(mon); bscallback = create_channelbsc(mon);
nsIWineURI_SetChannelBSC(nsuri, bscallback); hres = load_nsuri(This->window, nsuri, bscallback, LOAD_INITIAL_DOCUMENT_URI);
hres = load_nsuri(This->window, nsuri, LOAD_INITIAL_DOCUMENT_URI); nsISupports_Release((nsISupports*)nsuri); /* FIXME */
nsIWineURI_SetChannelBSC(nsuri, NULL);
if(SUCCEEDED(hres)) if(SUCCEEDED(hres))
set_window_bscallback(This->window, bscallback); set_window_bscallback(This->window, bscallback);
IUnknown_Release((IUnknown*)bscallback); IUnknown_Release((IUnknown*)bscallback);
......
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