Commit 69f4a1bf authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Make sure we always create nsWineURI with valid IUri.

parent 95d769a0
...@@ -95,7 +95,7 @@ static BOOL ensure_uri(nsWineURI *This) ...@@ -95,7 +95,7 @@ static BOOL ensure_uri(nsWineURI *This)
return TRUE; return TRUE;
} }
static nsresult create_uri(nsIURI*,HTMLWindow*,NSContainer*,nsWineURI**); static nsresult create_nsuri(IUri*,nsIURI*,HTMLWindow*,NSContainer*,nsWineURI**);
static const char *debugstr_nsacstr(const nsACString *nsstr) static const char *debugstr_nsacstr(const nsACString *nsstr)
{ {
...@@ -2111,14 +2111,12 @@ static nsresult NSAPI nsURI_Clone(nsIURL *iface, nsIURI **_retval) ...@@ -2111,14 +2111,12 @@ static nsresult NSAPI nsURI_Clone(nsIURL *iface, nsIURI **_retval)
} }
} }
nsres = create_uri(nsuri, This->window_ref ? This->window_ref->window : NULL, This->container, &wine_uri); nsres = create_nsuri(This->uri, nsuri, This->window_ref ? This->window_ref->window : NULL, This->container, &wine_uri);
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
WARN("create_uri failed: %08x\n", nsres); WARN("create_nsuri failed: %08x\n", nsres);
return nsres; return nsres;
} }
wine_uri->uri = This->uri;
IUri_AddRef(wine_uri->uri);
sync_wine_url(wine_uri); sync_wine_url(wine_uri);
*_retval = (nsIURI*)&wine_uri->nsIURL_iface; *_retval = (nsIURI*)&wine_uri->nsIURL_iface;
...@@ -2515,7 +2513,7 @@ static const nsIURLVtbl nsURLVtbl = { ...@@ -2515,7 +2513,7 @@ static const nsIURLVtbl nsURLVtbl = {
nsURL_GetRelativeSpec nsURL_GetRelativeSpec
}; };
static nsresult create_uri(nsIURI *nsuri, HTMLWindow *window, NSContainer *container, nsWineURI **_retval) static nsresult create_nsuri(IUri *iuri, nsIURI *nsuri, HTMLWindow *window, NSContainer *container, nsWineURI **_retval)
{ {
nsWineURI *ret = heap_alloc_zero(sizeof(nsWineURI)); nsWineURI *ret = heap_alloc_zero(sizeof(nsWineURI));
...@@ -2526,6 +2524,9 @@ static nsresult create_uri(nsIURI *nsuri, HTMLWindow *window, NSContainer *conta ...@@ -2526,6 +2524,9 @@ static nsresult create_uri(nsIURI *nsuri, HTMLWindow *window, NSContainer *conta
set_uri_nscontainer(ret, container); set_uri_nscontainer(ret, container);
set_uri_window(ret, window); set_uri_window(ret, window);
IUri_AddRef(iuri);
ret->uri = iuri;
if(nsuri) if(nsuri)
nsIURI_QueryInterface(nsuri, &IID_nsIURL, (void**)&ret->nsurl); nsIURI_QueryInterface(nsuri, &IID_nsIURL, (void**)&ret->nsurl);
...@@ -2537,9 +2538,16 @@ static nsresult create_uri(nsIURI *nsuri, HTMLWindow *window, NSContainer *conta ...@@ -2537,9 +2538,16 @@ static nsresult create_uri(nsIURI *nsuri, HTMLWindow *window, NSContainer *conta
HRESULT create_doc_uri(HTMLWindow *window, WCHAR *url, nsWineURI **ret) HRESULT create_doc_uri(HTMLWindow *window, WCHAR *url, nsWineURI **ret)
{ {
nsWineURI *uri; nsWineURI *uri;
IUri *iuri;
nsresult nsres; nsresult nsres;
HRESULT hres;
hres = CreateUri(url, 0, 0, &iuri);
if(FAILED(hres))
return hres;
nsres = create_uri(NULL, window, window->doc_obj->nscontainer, &uri); nsres = create_nsuri(iuri, NULL, window, window->doc_obj->nscontainer, &uri);
IUri_Release(iuri);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
...@@ -2586,22 +2594,24 @@ HRESULT create_redirect_nschannel(const WCHAR *url, nsChannel *orig_channel, nsC ...@@ -2586,22 +2594,24 @@ HRESULT create_redirect_nschannel(const WCHAR *url, nsChannel *orig_channel, nsC
HTMLWindow *window = NULL; HTMLWindow *window = NULL;
nsChannel *channel; nsChannel *channel;
nsWineURI *uri; nsWineURI *uri;
IUri *iuri;
nsresult nsres; nsresult nsres;
HRESULT hres; HRESULT hres;
hres = CreateUri(url, 0, 0, &iuri);
if(FAILED(hres))
return hres;
if(orig_channel->uri->window_ref) if(orig_channel->uri->window_ref)
window = orig_channel->uri->window_ref->window; window = orig_channel->uri->window_ref->window;
nsres = create_uri(NULL, window, NULL, &uri); nsres = create_nsuri(iuri, NULL, window, NULL, &uri);
IUri_Release(iuri);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
hres = CreateUri(url, 0, 0, &uri->uri);
if(SUCCEEDED(hres))
nsres = create_nschannel(uri, &channel);
sync_wine_url(uri); sync_wine_url(uri);
nsres = create_nschannel(uri, &channel);
nsIURL_Release(&uri->nsIURL_iface); nsIURL_Release(&uri->nsIURL_iface);
if(FAILED(hres))
return hres;
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
...@@ -2918,14 +2928,13 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString * ...@@ -2918,14 +2928,13 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *
return nsres; return nsres;
} }
nsres = create_uri(uri, window, NULL, &wine_uri); nsres = create_nsuri(urlmon_uri, uri, window, NULL, &wine_uri);
IUri_Release(urlmon_uri);
if(base_wine_uri) if(base_wine_uri)
nsIURI_Release(&base_wine_uri->nsIURL_iface); nsIURI_Release(&base_wine_uri->nsIURL_iface);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return nsres; return nsres;
wine_uri->uri = urlmon_uri;
sync_wine_url(wine_uri); sync_wine_url(wine_uri);
*_retval = (nsIURI*)wine_uri; *_retval = (nsIURI*)wine_uri;
return nsres; return nsres;
......
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