Module: wine Branch: master Commit: d95a54aa575bed9a96eeccc62af6d3e4445bd3cd URL: http://source.winehq.org/git/wine.git/?a=commit;h=d95a54aa575bed9a96eeccc62a...
Author: Jacek Caban jacek@codeweavers.com Date: Sun Feb 21 21:05:15 2010 +0100
mshtml: Store nsWineURI object instead of interface in nsChannel.
---
dlls/mshtml/mshtml_private.h | 6 ++- dlls/mshtml/navigate.c | 2 +- dlls/mshtml/nsio.c | 92 ++++++++++++++++-------------------------- 3 files changed, 41 insertions(+), 59 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c65bffa..019f66f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -434,6 +434,10 @@ struct NSContainer { HWND reset_focus; /* hack */ };
+typedef struct nsWineURI nsWineURI; + +HRESULT set_wine_url(nsWineURI*,LPCWSTR); + typedef struct { const nsIHttpChannelVtbl *lpHttpChannelVtbl; const nsIUploadChannelVtbl *lpUploadChannelVtbl; @@ -441,7 +445,7 @@ typedef struct {
LONG ref;
- nsIWineURI *uri; + nsWineURI *uri; nsIInputStream *post_data_stream; nsILoadGroup *load_group; nsIInterfaceRequestor *notif_callback; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index b85de92..b0620d5 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1087,7 +1087,7 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG status_code, LPCW TRACE("redirect to %s\n", debugstr_w(status_text));
/* 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; diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 15bd0b2..b9e1e60 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -49,7 +49,7 @@ static nsINetUtil *net_util;
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
-typedef struct { +struct nsWineURI { const nsIWineURIVtbl *lpWineURIVtbl;
LONG ref; @@ -62,7 +62,7 @@ typedef struct { LPWSTR wine_url; PRBool is_doc_uri; BOOL use_wine_url; -} nsWineURI; +};
#define NSURI(x) ((nsIURI*) &(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; DWORD hlnf = 0; - LPCWSTR uri; HRESULT hres;
- nsIWineURI_GetWineURL(channel->uri, &uri); - if(!uri) { - ERR("GetWineURL returned NULL\n"); - return TRUE; - } - if(!doc) { NSContainer *container_iter = container;
@@ -150,13 +143,19 @@ static BOOL before_async_open(nsChannel *channel, NSContainer *container) if(!doc->client) return TRUE;
- if(!hlnf && !exec_shldocvw_67(doc, uri)) + if(!hlnf && !exec_shldocvw_67(doc, channel->uri->wine_url)) 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; }
+HRESULT set_wine_url(nsWineURI *This, LPCWSTR url) +{ + nsIWineURI_SetWineURL(NSWINEURI(This), url); + return S_OK; +} + static inline BOOL is_http_channel(nsChannel *This) { 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);
if(!ref) { - nsIWineURI_Release(This->uri); + nsIURI_Release(NSURI(This->uri)); if(This->owner) nsISupports_Release(This->owner); if(This->post_data_stream) @@ -369,7 +368,7 @@ static nsresult NSAPI nsChannel_GetURI(nsIHttpChannel *iface, nsIURI **aURI)
TRACE("(%p)->(%p)\n", This, aURI);
- nsIWineURI_AddRef(This->uri); + nsIURI_AddRef(NSURI(This->uri)); *aURI = (nsIURI*)This->uri;
return NS_OK; @@ -720,51 +719,36 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen { nsChannel *This = NSCHANNEL_THIS(iface); HTMLWindow *window = NULL; - PRBool is_doc_uri; BOOL open = TRUE; nsresult nsres = NS_OK;
- TRACE("(%p)->(%p %p)\n", This, aListener, aContext); - - if(TRACE_ON(mshtml)) { - LPCWSTR url; + TRACE("(%p)->(%p %p) opening %s\n", This, aListener, aContext, debugstr_w(This->uri->wine_url));
- nsIWineURI_GetWineURL(This->uri, &url); - TRACE("opening %s\n", debugstr_w(url)); - } - - nsIWineURI_GetIsDocumentURI(This->uri, &is_doc_uri); - if(is_doc_uri) { + if(This->uri->is_doc_uri) { window = get_channel_window(This); if(window) { - nsIWineURI_SetWindow(This->uri, window); - }else { - NSContainer *nscontainer; - - nsIWineURI_GetNSContainer(This->uri, &nscontainer); - if(nscontainer) { - BOOL b; - - /* nscontainer->doc should be NULL which means navigation to a new window */ - if(nscontainer->doc) - FIXME("nscontainer->doc = %p\n", nscontainer->doc); - - b = before_async_open(This, nscontainer); - nsIWebBrowserChrome_Release(NSWBCHROME(nscontainer)); - if(b) - FIXME("Navigation not cancelled\n"); - return NS_ERROR_UNEXPECTED; - } + nsIWineURI_SetWindow(NSWINEURI(This->uri), window); + }else if(This->uri->container) { + BOOL b; + + /* nscontainer->doc should be NULL which means navigation to a new window */ + if(This->uri->container->doc) + FIXME("nscontainer->doc = %p\n", This->uri->container->doc); + + b = before_async_open(This, This->uri->container); + if(b) + FIXME("Navigation not cancelled\n"); + return NS_ERROR_UNEXPECTED; } }
if(!window) { - nsIWineURI_GetWindow(This->uri, &window); + nsIWineURI_GetWindow(NSWINEURI(This->uri), &window);
if(!window && This->load_group) { window = get_window_from_load_group(This); 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; }
- if(is_doc_uri && window == window->doc_obj->basedoc.window) { - nsChannelBSC *channel_bsc; - - nsIWineURI_GetChannelBSC(This->uri, &channel_bsc); - if(channel_bsc) { - channelbsc_set_channel(channel_bsc, This, aListener, aContext); - IUnknown_Release((IUnknown*)channel_bsc); + if(This->uri->is_doc_uri && window == window->doc_obj->basedoc.window) { + if(This->uri->channel_bsc) { + channelbsc_set_channel(This->uri->channel_bsc, This, aListener, aContext);
if(window->doc_obj->mime) { heap_free(This->content_type); @@ -797,7 +777,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen }
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)); return nsres; @@ -2556,8 +2536,7 @@ static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI { PARSEDURLW parsed_url = {sizeof(PARSEDURLW)}; nsChannel *ret; - nsIWineURI *wine_uri; - const WCHAR *url; + nsWineURI *wine_uri; nsresult nsres;
TRACE("(%p %p)\n", aURI, _retval); @@ -2578,9 +2557,8 @@ static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI
nsIURI_AddRef(aURI); ret->original_uri = aURI; - - nsIWineURI_GetWineURL(wine_uri, &url); - ret->url_scheme = url && SUCCEEDED(ParseURLW(url, &parsed_url)) ? parsed_url.nScheme : URL_SCHEME_UNKNOWN; + ret->url_scheme = wine_uri->wine_url && SUCCEEDED(ParseURLW(wine_uri->wine_url, &parsed_url)) + ? parsed_url.nScheme : URL_SCHEME_UNKNOWN;
*_retval = NSCHANNEL(ret); return NS_OK;