mshtml: Store nsWineURI object instead of interface in nsChannel.

This commit is contained in:
Jacek Caban 2010-02-21 21:05:15 +01:00 committed by Alexandre Julliard
parent 4ab63f3ad8
commit d95a54aa57
3 changed files with 39 additions and 57 deletions

View File

@ -434,6 +434,10 @@ struct NSContainer {
HWND reset_focus; /* hack */ HWND reset_focus; /* hack */
}; };
typedef struct nsWineURI nsWineURI;
HRESULT set_wine_url(nsWineURI*,LPCWSTR);
typedef struct { typedef struct {
const nsIHttpChannelVtbl *lpHttpChannelVtbl; const nsIHttpChannelVtbl *lpHttpChannelVtbl;
const nsIUploadChannelVtbl *lpUploadChannelVtbl; const nsIUploadChannelVtbl *lpUploadChannelVtbl;
@ -441,7 +445,7 @@ typedef struct {
LONG ref; LONG ref;
nsIWineURI *uri; nsWineURI *uri;
nsIInputStream *post_data_stream; nsIInputStream *post_data_stream;
nsILoadGroup *load_group; nsILoadGroup *load_group;
nsIInterfaceRequestor *notif_callback; nsIInterfaceRequestor *notif_callback;

View File

@ -1087,7 +1087,7 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG status_code, LPCW
TRACE("redirect to %s\n", debugstr_w(status_text)); TRACE("redirect to %s\n", debugstr_w(status_text));
/* FIXME: We should find a better way to handle this */ /* FIXME: We should find a better way to handle this */
nsIWineURI_SetWineURL(This->nschannel->uri, status_text); set_wine_url(This->nschannel->uri, status_text);
} }
return S_OK; return S_OK;

View File

@ -49,7 +49,7 @@ static nsINetUtil *net_util;
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
typedef struct { struct nsWineURI {
const nsIWineURIVtbl *lpWineURIVtbl; const nsIWineURIVtbl *lpWineURIVtbl;
LONG ref; LONG ref;
@ -62,7 +62,7 @@ typedef struct {
LPWSTR wine_url; LPWSTR wine_url;
PRBool is_doc_uri; PRBool is_doc_uri;
BOOL use_wine_url; BOOL use_wine_url;
} 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)
@ -129,15 +129,8 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
{ {
HTMLDocumentObj *doc = container->doc; HTMLDocumentObj *doc = container->doc;
DWORD hlnf = 0; DWORD hlnf = 0;
LPCWSTR uri;
HRESULT hres; HRESULT hres;
nsIWineURI_GetWineURL(channel->uri, &uri);
if(!uri) {
ERR("GetWineURL returned NULL\n");
return TRUE;
}
if(!doc) { if(!doc) {
NSContainer *container_iter = container; NSContainer *container_iter = container;
@ -150,13 +143,19 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container)
if(!doc->client) if(!doc->client)
return TRUE; return TRUE;
if(!hlnf && !exec_shldocvw_67(doc, uri)) if(!hlnf && !exec_shldocvw_67(doc, channel->uri->wine_url))
return FALSE; return FALSE;
hres = hlink_frame_navigate(&doc->basedoc, uri, channel->post_data_stream, hlnf); hres = hlink_frame_navigate(&doc->basedoc, channel->uri->wine_url, channel->post_data_stream, hlnf);
return hres != S_OK; return hres != S_OK;
} }
HRESULT set_wine_url(nsWineURI *This, LPCWSTR url)
{
nsIWineURI_SetWineURL(NSWINEURI(This), url);
return S_OK;
}
static inline BOOL is_http_channel(nsChannel *This) static inline BOOL is_http_channel(nsChannel *This)
{ {
return This->url_scheme == URL_SCHEME_HTTP || This->url_scheme == URL_SCHEME_HTTP; return This->url_scheme == URL_SCHEME_HTTP || This->url_scheme == URL_SCHEME_HTTP;
@ -215,7 +214,7 @@ static nsrefcnt NSAPI nsChannel_Release(nsIHttpChannel *iface)
LONG ref = InterlockedDecrement(&This->ref); LONG ref = InterlockedDecrement(&This->ref);
if(!ref) { if(!ref) {
nsIWineURI_Release(This->uri); nsIURI_Release(NSURI(This->uri));
if(This->owner) if(This->owner)
nsISupports_Release(This->owner); nsISupports_Release(This->owner);
if(This->post_data_stream) if(This->post_data_stream)
@ -369,7 +368,7 @@ static nsresult NSAPI nsChannel_GetURI(nsIHttpChannel *iface, nsIURI **aURI)
TRACE("(%p)->(%p)\n", This, aURI); TRACE("(%p)->(%p)\n", This, aURI);
nsIWineURI_AddRef(This->uri); nsIURI_AddRef(NSURI(This->uri));
*aURI = (nsIURI*)This->uri; *aURI = (nsIURI*)This->uri;
return NS_OK; return NS_OK;
@ -720,51 +719,36 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
{ {
nsChannel *This = NSCHANNEL_THIS(iface); nsChannel *This = NSCHANNEL_THIS(iface);
HTMLWindow *window = NULL; HTMLWindow *window = NULL;
PRBool is_doc_uri;
BOOL open = TRUE; BOOL open = TRUE;
nsresult nsres = NS_OK; nsresult nsres = NS_OK;
TRACE("(%p)->(%p %p)\n", This, aListener, aContext); TRACE("(%p)->(%p %p) opening %s\n", This, aListener, aContext, debugstr_w(This->uri->wine_url));
if(TRACE_ON(mshtml)) { if(This->uri->is_doc_uri) {
LPCWSTR url;
nsIWineURI_GetWineURL(This->uri, &url);
TRACE("opening %s\n", debugstr_w(url));
}
nsIWineURI_GetIsDocumentURI(This->uri, &is_doc_uri);
if(is_doc_uri) {
window = get_channel_window(This); window = get_channel_window(This);
if(window) { if(window) {
nsIWineURI_SetWindow(This->uri, window); nsIWineURI_SetWindow(NSWINEURI(This->uri), window);
}else { }else if(This->uri->container) {
NSContainer *nscontainer;
nsIWineURI_GetNSContainer(This->uri, &nscontainer);
if(nscontainer) {
BOOL b; BOOL b;
/* nscontainer->doc should be NULL which means navigation to a new window */ /* nscontainer->doc should be NULL which means navigation to a new window */
if(nscontainer->doc) if(This->uri->container->doc)
FIXME("nscontainer->doc = %p\n", nscontainer->doc); FIXME("nscontainer->doc = %p\n", This->uri->container->doc);
b = before_async_open(This, nscontainer); b = before_async_open(This, This->uri->container);
nsIWebBrowserChrome_Release(NSWBCHROME(nscontainer));
if(b) if(b)
FIXME("Navigation not cancelled\n"); FIXME("Navigation not cancelled\n");
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
} }
}
if(!window) { if(!window) {
nsIWineURI_GetWindow(This->uri, &window); nsIWineURI_GetWindow(NSWINEURI(This->uri), &window);
if(!window && This->load_group) { if(!window && This->load_group) {
window = get_window_from_load_group(This); window = get_window_from_load_group(This);
if(window) if(window)
nsIWineURI_SetWindow(This->uri, window); nsIWineURI_SetWindow(NSWINEURI(This->uri), window);
} }
} }
@ -773,13 +757,9 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
if(is_doc_uri && window == window->doc_obj->basedoc.window) { if(This->uri->is_doc_uri && window == window->doc_obj->basedoc.window) {
nsChannelBSC *channel_bsc; if(This->uri->channel_bsc) {
channelbsc_set_channel(This->uri->channel_bsc, This, aListener, aContext);
nsIWineURI_GetChannelBSC(This->uri, &channel_bsc);
if(channel_bsc) {
channelbsc_set_channel(channel_bsc, This, aListener, aContext);
IUnknown_Release((IUnknown*)channel_bsc);
if(window->doc_obj->mime) { if(window->doc_obj->mime) {
heap_free(This->content_type); heap_free(This->content_type);
@ -797,7 +777,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
} }
if(open) if(open)
nsres = async_open(This, window, is_doc_uri, aListener, aContext); nsres = async_open(This, window, This->uri->is_doc_uri, aListener, aContext);
IHTMLWindow2_Release(HTMLWINDOW2(window)); IHTMLWindow2_Release(HTMLWINDOW2(window));
return nsres; return nsres;
@ -2556,8 +2536,7 @@ static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI
{ {
PARSEDURLW parsed_url = {sizeof(PARSEDURLW)}; PARSEDURLW parsed_url = {sizeof(PARSEDURLW)};
nsChannel *ret; nsChannel *ret;
nsIWineURI *wine_uri; nsWineURI *wine_uri;
const WCHAR *url;
nsresult nsres; nsresult nsres;
TRACE("(%p %p)\n", aURI, _retval); TRACE("(%p %p)\n", aURI, _retval);
@ -2578,9 +2557,8 @@ static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI
nsIURI_AddRef(aURI); nsIURI_AddRef(aURI);
ret->original_uri = aURI; ret->original_uri = aURI;
ret->url_scheme = wine_uri->wine_url && SUCCEEDED(ParseURLW(wine_uri->wine_url, &parsed_url))
nsIWineURI_GetWineURL(wine_uri, &url); ? parsed_url.nScheme : URL_SCHEME_UNKNOWN;
ret->url_scheme = url && SUCCEEDED(ParseURLW(url, &parsed_url)) ? parsed_url.nScheme : URL_SCHEME_UNKNOWN;
*_retval = NSCHANNEL(ret); *_retval = NSCHANNEL(ret);
return NS_OK; return NS_OK;