WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
-#define LOAD_INITIAL_DOCUMENT_URI 0x80000
-
#define NS_IOSERVICE_CLASSNAME "nsIOService"
#define NS_IOSERVICE_CONTRACTID "@mozilla.org/network/io-service;1"
static const IID NS_IOSERVICE_CID =
{0x9ac9e770, 0x18bc, 0x11d3, {0x93, 0x37, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40}};
+static const IID IID_nsWineURI =
+ {0x5088272e, 0x900b, 0x11da, {0xc6,0x87, 0x00,0x0f,0xea,0x57,0xf2,0x1a}};
static nsIIOService *nsio = NULL;
static nsINetUtil *net_util;
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
-typedef struct {
- const nsIWineURIVtbl *lpWineURIVtbl;
+struct nsWineURI {
+ const nsIURLVtbl *lpIURLVtbl;
LONG ref;
nsIURL *nsurl;
NSContainer *container;
windowref_t *window_ref;
+ nsChannelBSC *channel_bsc;
LPWSTR wine_url;
- PRBool is_doc_uri;
+ BOOL is_doc_uri;
BOOL use_wine_url;
-} nsURI;
+};
-#define NSURI(x) ((nsIURI*) &(x)->lpWineURIVtbl)
-#define NSWINEURI(x) ((nsIWineURI*) &(x)->lpWineURIVtbl)
+#define NSURI(x) ((nsIURI*) &(x)->lpIURLVtbl)
+#define NSURL(x) ((nsIURL*) &(x)->lpIURLVtbl)
-static nsresult create_uri(nsIURI*,HTMLWindow*,NSContainer*,nsIWineURI**);
+static nsresult create_uri(nsIURI*,HTMLWindow*,NSContainer*,nsWineURI**);
static const char *debugstr_nsacstr(const nsACString *nsstr)
{
{
HTMLDocumentObj *doc = container->doc;
DWORD hlnf = 0;
- LPCWSTR uri;
+ BOOL cancel;
HRESULT hres;
- nsIWineURI_GetWineURL(channel->uri, &uri);
- if(!uri) {
- ERR("GetWineURL returned NULL\n");
- return TRUE;
- }
-
if(!doc) {
NSContainer *container_iter = 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, channel->uri->wine_url, channel->post_data_stream, hlnf, &cancel);
+ return FAILED(hres) || cancel;
+}
+
+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)
+{
+ OLECHAR *new_url = NULL, *url;
+ BOOL ret = FALSE;
+ HRESULT hres;
+
+ if(!doc->hostui)
+ return FALSE;
+
+ url = heap_strdupW(uri->wine_url);
+ hres = IDocHostUIHandler_TranslateUrl(doc->hostui, 0, url, &new_url);
+ heap_free(url);
+ if(hres != S_OK || !new_url)
return FALSE;
- hres = hlink_frame_navigate(&doc->basedoc, uri, channel->post_data_stream, hlnf);
- return hres != S_OK;
+ if(strcmpW(url, new_url)) {
+ FIXME("TranslateUrl returned new URL %s -> %s\n", debugstr_w(url), debugstr_w(new_url));
+ ret = TRUE;
+ }
+
+ CoTaskMemFree(new_url);
+ return ret;
+}
+
+nsresult on_start_uri_open(NSContainer *nscontainer, nsIURI *uri, PRBool *_retval)
+{
+ nsWineURI *wine_uri;
+ nsresult nsres;
+
+ *_retval = FALSE;
+
+ nsres = nsIURI_QueryInterface(uri, &IID_nsWineURI, (void**)&wine_uri);
+ if(NS_FAILED(nsres)) {
+ WARN("Could not get nsWineURI: %08x\n", nsres);
+ return NS_ERROR_NOT_IMPLEMENTED;
+ }
+
+ if(!wine_uri->is_doc_uri) {
+ if(!wine_uri->container) {
+ nsIWebBrowserChrome_AddRef(NSWBCHROME(nscontainer));
+ wine_uri->container = nscontainer;
+ }
+
+ wine_uri->is_doc_uri = TRUE;
+ *_retval = translate_url(nscontainer->doc->basedoc.doc_obj, wine_uri);
+ }
+
+ nsIURI_Release(NSURI(wine_uri));
+ return NS_OK;
+}
+
+HRESULT set_wine_url(nsWineURI *This, LPCWSTR url)
+{
+ static const WCHAR wszFtp[] = {'f','t','p',':'};
+ static const WCHAR wszHttp[] = {'h','t','t','p',':'};
+ static const WCHAR wszHttps[] = {'h','t','t','p','s',':'};
+
+ TRACE("(%p)->(%s)\n", This, debugstr_w(url));
+
+ if(url) {
+ WCHAR *new_url;
+
+ new_url = heap_strdupW(url);
+ if(!new_url)
+ return E_OUTOFMEMORY;
+ heap_free(This->wine_url);
+ This->wine_url = new_url;
+
+ if(This->uri) {
+ /* FIXME: Always use wine url */
+ This->use_wine_url =
+ strncmpW(url, wszFtp, sizeof(wszFtp)/sizeof(WCHAR))
+ && strncmpW(url, wszHttp, sizeof(wszHttp)/sizeof(WCHAR))
+ && strncmpW(url, wszHttps, sizeof(wszHttps)/sizeof(WCHAR));
+ }else {
+ This->use_wine_url = TRUE;
+ }
+ }else {
+ heap_free(This->wine_url);
+ This->wine_url = NULL;
+ This->use_wine_url = FALSE;
+ }
+
+ return S_OK;
+}
+
+static void set_uri_nscontainer(nsWineURI *This, NSContainer *nscontainer)
+{
+ if(This->container) {
+ if(This->container == nscontainer)
+ return;
+ TRACE("Changing %p -> %p\n", This->container, nscontainer);
+ nsIWebBrowserChrome_Release(NSWBCHROME(This->container));
+ }
+
+ if(nscontainer)
+ nsIWebBrowserChrome_AddRef(NSWBCHROME(nscontainer));
+ This->container = nscontainer;
+}
+
+static void set_uri_window(nsWineURI *This, HTMLWindow *window)
+{
+ if(This->window_ref) {
+ if(This->window_ref->window == window)
+ return;
+ TRACE("Changing %p -> %p\n", This->window_ref->window, window);
+ windowref_release(This->window_ref);
+ }
+
+ if(window) {
+ windowref_addref(window->window_ref);
+ This->window_ref = window->window_ref;
+
+ if(window->doc_obj)
+ set_uri_nscontainer(This, window->doc_obj->nscontainer);
+ }else {
+ This->window_ref = NULL;
+ }
+}
+
+static inline BOOL is_http_channel(nsChannel *This)
+{
+ return This->url_scheme == URL_SCHEME_HTTP || This->url_scheme == URL_SCHEME_HTTP;
}
#define NSCHANNEL_THIS(iface) DEFINE_THIS(nsChannel, HttpChannel, iface)
*result = NSCHANNEL(This);
}else if(IsEqualGUID(&IID_nsIHttpChannel, riid)) {
TRACE("(%p)->(IID_nsIHttpChannel %p)\n", This, result);
- *result = This->http_channel ? NSHTTPCHANNEL(This) : NULL;
+ *result = is_http_channel(This) ? NSHTTPCHANNEL(This) : NULL;
}else if(IsEqualGUID(&IID_nsIUploadChannel, riid)) {
TRACE("(%p)->(IID_nsIUploadChannel %p)\n", This, result);
*result = NSUPCHANNEL(This);
}else if(IsEqualGUID(&IID_nsIHttpChannelInternal, riid)) {
TRACE("(%p)->(IID_nsIHttpChannelInternal %p)\n", This, result);
- *result = This->http_channel_internal ? NSHTTPINTERNAL(This) : NULL;
+ *result = is_http_channel(This) ? NSHTTPINTERNAL(This) : NULL;
}else {
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
*result = NULL;
LONG ref = InterlockedDecrement(&This->ref);
if(!ref) {
- nsIWineURI_Release(This->uri);
- if(This->channel)
- nsIChannel_Release(This->channel);
- if(This->http_channel)
- nsIHttpChannel_Release(This->http_channel);
- if(This->http_channel_internal)
- nsIHttpChannel_Release(This->http_channel_internal);
+ nsIURI_Release(NSURI(This->uri));
if(This->owner)
nsISupports_Release(This->owner);
if(This->post_data_stream)
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aName);
-
- if(This->channel)
- return nsIChannel_GetName(This->channel, aName);
+ FIXME("(%p)->(%p)\n", This, aName);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, _retval);
-
- if(This->channel)
- return nsIChannel_IsPending(This->channel, _retval);
+ FIXME("(%p)->(%p)\n", This, _retval);
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aStatus);
-
- if(This->channel)
- return nsIChannel_GetStatus(This->channel, aStatus);
+ WARN("(%p)->(%p) returning NS_OK\n", This, aStatus);
- TRACE("returning NS_OK\n");
return *aStatus = NS_OK;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%08x)\n", This, aStatus);
-
- if(This->channel)
- return nsIChannel_Cancel(This->channel, aStatus);
+ FIXME("(%p)->(%08x)\n", This, aStatus);
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)\n", This);
-
- if(This->channel)
- return nsIChannel_Suspend(This->channel);
+ FIXME("(%p)\n", This);
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)\n", This);
-
- if(This->channel)
- return nsIChannel_Resume(This->channel);
+ FIXME("(%p)\n", This);
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
nsILoadGroup_Release(This->load_group);
if(aLoadGroup)
nsILoadGroup_AddRef(aLoadGroup);
-
This->load_group = aLoadGroup;
- if(This->channel)
- return nsIChannel_SetLoadGroup(This->channel, aLoadGroup);
return NS_OK;
}
TRACE("(%p)->(%08x)\n", This, aLoadFlags);
This->load_flags = aLoadFlags;
-
- if(This->channel)
- return nsIChannel_SetLoadFlags(This->channel, aLoadFlags);
return NS_OK;
}
nsIURI_AddRef(aOriginalURI);
This->original_uri = aOriginalURI;
-
- if(This->channel)
- return nsIChannel_SetOriginalURI(This->channel, aOriginalURI);
return NS_OK;
}
TRACE("(%p)->(%p)\n", This, aURI);
- nsIWineURI_AddRef(This->uri);
+ nsIURI_AddRef(NSURI(This->uri));
*aURI = (nsIURI*)This->uri;
return NS_OK;
TRACE("(%p)->(%p)\n", This, aOwner);
- if(This->channel)
- return nsIChannel_GetOwner(This->channel, aOwner);
-
if(This->owner)
nsISupports_AddRef(This->owner);
*aOwner = This->owner;
TRACE("(%p)->(%p)\n", This, aOwner);
- if(This->channel)
- return nsIChannel_SetOwner(This->channel, aOwner);
-
if(aOwner)
nsISupports_AddRef(aOwner);
if(This->owner)
This->notif_callback = aNotificationCallbacks;
- if(This->channel)
- return nsIChannel_SetNotificationCallbacks(This->channel, aNotificationCallbacks);
return NS_OK;
}
TRACE("(%p)->(%p)\n", This, aSecurityInfo);
- if(This->channel)
- return nsIChannel_GetSecurityInfo(This->channel, aSecurityInfo);
-
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
return S_OK;
}
- if(This->channel)
- return nsIChannel_GetContentType(This->channel, aContentType);
-
WARN("unknown type\n");
return NS_ERROR_FAILURE;
}
heap_free(This->content_type);
This->content_type = heap_strdupA(content_type);
- if(This->channel)
- return nsIChannel_SetContentType(This->channel, aContentType);
-
return NS_OK;
}
return NS_OK;
}
- if(This->channel) {
- nsresult nsres = nsIChannel_GetContentCharset(This->channel, aContentCharset);
- const char *ch;
- nsACString_GetData(aContentCharset, &ch);
- return nsres;
- }
-
nsACString_SetData(aContentCharset, "");
return NS_OK;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aContentCharset);
+ FIXME("(%p)->(%p)\n", This, aContentCharset);
- if(This->channel)
- return nsIChannel_SetContentCharset(This->channel, aContentCharset);
-
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aContentLength);
+ FIXME("(%p)->(%p)\n", This, aContentLength);
- if(This->channel)
- return nsIChannel_GetContentLength(This->channel, aContentLength);
-
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%d)\n", This, aContentLength);
-
- if(This->channel)
- return nsIChannel_SetContentLength(This->channel, aContentLength);
+ FIXME("(%p)->(%d)\n", This, aContentLength);
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, _retval);
+ FIXME("(%p)->(%p)\n", This, _retval);
- if(This->channel)
- return nsIChannel_Open(This->channel, _retval);
-
- FIXME("default action not implemented\n");
return NS_ERROR_NOT_IMPLEMENTED;
}
static HRESULT create_mon_for_nschannel(nsChannel *channel, IMoniker **mon)
{
- nsIWineURI *wine_uri;
- LPCWSTR wine_url;
+ nsWineURI *wine_uri;
nsresult nsres;
HRESULT hres;
return E_FAIL;
}
- nsres = nsIURI_QueryInterface(channel->original_uri, &IID_nsIWineURI, (void**)&wine_uri);
+ nsres = nsIURI_QueryInterface(channel->original_uri, &IID_nsWineURI, (void**)&wine_uri);
if(NS_FAILED(nsres)) {
- ERR("Could not get nsIWineURI: %08x\n", nsres);
+ ERR("Could not get nsWineURI: %08x\n", nsres);
return E_FAIL;
}
- nsIWineURI_GetWineURL(wine_uri, &wine_url);
- nsIWineURI_Release(wine_uri);
- if(!wine_url) {
+ if(wine_uri->wine_url) {
+ hres = CreateURLMoniker(NULL, wine_uri->wine_url, mon);
+ if(FAILED(hres))
+ WARN("CreateURLMoniker failed: %08x\n", hres);
+ }else {
TRACE("wine_url == NULL\n");
- return E_FAIL;
+ hres = E_FAIL;
}
- hres = CreateURLMoniker(NULL, wine_url, mon);
- if(FAILED(hres))
- WARN("CreateURLMoniker failed: %08x\n", hres);
+ nsIURI_Release(NSURI(wine_uri));
return hres;
}
HTMLWindow *window;
nsIChannel *channel;
nsIRequest *req;
- nsIWineURI *wine_uri;
+ nsWineURI *wine_uri;
nsIURI *uri;
nsresult nsres;
return NULL;
}
- nsres = nsIURI_QueryInterface(uri, &IID_nsIWineURI, (void**)&wine_uri);
+ nsres = nsIURI_QueryInterface(uri, &IID_nsWineURI, (void**)&wine_uri);
nsIURI_Release(uri);
if(NS_FAILED(nsres)) {
- TRACE("Could not get nsIWineURI: %08x\n", nsres);
+ TRACE("Could not get nsWineURI: %08x\n", nsres);
return NULL;
}
- nsIWineURI_GetWindow(wine_uri, &window);
- nsIWineURI_Release(wine_uri);
+ window = wine_uri->window_ref ? wine_uri->window_ref->window : NULL;
+ if(window)
+ IHTMLWindow2_AddRef(HTMLWINDOW2(window));
+ nsIURI_Release(NSURI(wine_uri));
return window;
}
start_binding_task_t *task = (start_binding_task_t*)_task;
start_binding(NULL, task->doc, (BSCallback*)task->bscallback, NULL);
-}
-typedef struct {
- task_t header;
- HTMLWindow *window;
- nsChannelBSC *bscallback;
-} start_doc_binding_task_t;
-
-static void start_doc_binding_proc(task_t *_task)
-{
- start_doc_binding_task_t *task = (start_doc_binding_task_t*)_task;
-
- start_binding(task->window, NULL, (BSCallback*)task->bscallback, NULL);
IUnknown_Release((IUnknown*)task->bscallback);
}
if(is_doc_channel)
set_current_mon(window, mon);
- bscallback = create_channelbsc(mon);
+ hres = create_channelbsc(mon, NULL, NULL, 0, &bscallback);
IMoniker_Release(mon);
+ if(FAILED(hres))
+ return NS_ERROR_UNEXPECTED;
channelbsc_set_channel(bscallback, This, listener, context);
if(is_doc_channel) {
- start_doc_binding_task_t *task;
-
set_window_bscallback(window, bscallback);
-
- task = heap_alloc(sizeof(start_doc_binding_task_t));
- task->window = window;
- task->bscallback = bscallback;
- push_task(&task->header, start_doc_binding_proc, window->task_magic);
+ async_start_doc_binding(window, bscallback);
+ IUnknown_Release((IUnknown*)bscallback);
}else {
start_binding_task_t *task = heap_alloc(sizeof(start_binding_task_t));
{
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;
-
- nsIWineURI_GetWineURL(This->uri, &url);
- TRACE("opening %s\n", debugstr_w(url));
- }
+ TRACE("(%p)->(%p %p) opening %s\n", This, aListener, aContext, debugstr_w(This->uri->wine_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;
- }
+ set_uri_window(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);
-
- if(!window && This->load_group) {
+ if(This->uri->window_ref && This->uri->window_ref->window) {
+ window = This->uri->window_ref->window;
+ IHTMLWindow2_AddRef(HTMLWINDOW2(window));
+ }else if(This->load_group) {
window = get_window_from_load_group(This);
if(window)
- nsIWineURI_SetWindow(This->uri, window);
+ set_uri_window(This->uri, window);
}
}
if(!window) {
- TRACE("window = NULL\n");
- return This->channel
- ? nsIChannel_AsyncOpen(This->channel, aListener, aContext)
- : NS_ERROR_UNEXPECTED;
+ ERR("window = NULL\n");
+ return NS_ERROR_UNEXPECTED;
}
- if(is_doc_uri && (This->load_flags & LOAD_INITIAL_DOCUMENT_URI)) {
- if(window->doc_obj->nscontainer->bscallback) {
- NSContainer *nscontainer = window->doc_obj->nscontainer;
+ 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);
- channelbsc_set_channel(nscontainer->bscallback, This, aListener, aContext);
-
- if(nscontainer->doc->mime) {
+ if(window->doc_obj->mime) {
heap_free(This->content_type);
- This->content_type = heap_strdupWtoA(nscontainer->doc->mime);
+ This->content_type = heap_strdupWtoA(window->doc_obj->mime);
}
open = FALSE;
}else {
- open = before_async_open(This, window->doc_obj->nscontainer);
+ open = !before_async_open(This, window->doc_obj->nscontainer);
if(!open) {
TRACE("canceled\n");
nsres = NS_ERROR_UNEXPECTED;
}
if(open)
- nsres = async_open(This, window, is_doc_uri, aListener, aContext);
+ nsres = async_open(This, window, This->uri->is_doc_uri, aListener, aContext);
- if(window)
- IHTMLWindow2_Release(HTMLWINDOW2(window));
+ IHTMLWindow2_Release(HTMLWINDOW2(window));
return nsres;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aRequestMethod);
-
- if(This->http_channel)
- return nsIHttpChannel_GetRequestMethod(This->http_channel, aRequestMethod);
+ FIXME("(%p)->(%p)\n", This, aRequestMethod);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aRequestMethod);
-
- if(This->http_channel)
- return nsIHttpChannel_SetRequestMethod(This->http_channel, aRequestMethod);
+ FIXME("(%p)->(%p)\n", This, aRequestMethod);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aReferrer);
-
- if(This->http_channel)
- return nsIHttpChannel_GetReferrer(This->http_channel, aReferrer);
+ FIXME("(%p)->(%p)\n", This, aReferrer);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aReferrer);
-
- if(This->http_channel)
- return nsIHttpChannel_SetReferrer(This->http_channel, aReferrer);
+ FIXME("(%p)->(%p)\n", This, aReferrer);
- return NS_ERROR_NOT_IMPLEMENTED;
+ return NS_OK;
}
static nsresult NSAPI nsChannel_GetRequestHeader(nsIHttpChannel *iface,
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p %p)\n", This, aHeader, _retval);
-
- if(This->http_channel)
- return nsIHttpChannel_GetRequestHeader(This->http_channel, aHeader, _retval);
+ FIXME("(%p)->(%p %p)\n", This, aHeader, _retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p %p %x)\n", This, aHeader, aValue, aMerge);
+ FIXME("(%p)->(%p %p %x)\n", This, aHeader, aValue, aMerge);
- if(This->http_channel)
- return nsIHttpChannel_SetRequestHeader(This->http_channel, aHeader, aValue, aMerge);
-
- return NS_ERROR_NOT_IMPLEMENTED;
+ return NS_OK;
}
static nsresult NSAPI nsChannel_VisitRequestHeaders(nsIHttpChannel *iface,
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aVisitor);
-
- if(This->http_channel)
- return nsIHttpChannel_VisitRequestHeaders(This->http_channel, aVisitor);
+ FIXME("(%p)->(%p)\n", This, aVisitor);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aAllowPipelining);
-
- if(This->http_channel)
- return nsIHttpChannel_GetAllowPipelining(This->http_channel, aAllowPipelining);
+ FIXME("(%p)->(%p)\n", This, aAllowPipelining);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%x)\n", This, aAllowPipelining);
-
- if(This->http_channel)
- return nsIHttpChannel_SetAllowPipelining(This->http_channel, aAllowPipelining);
+ FIXME("(%p)->(%x)\n", This, aAllowPipelining);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aRedirectionLimit);
-
- if(This->http_channel)
- return nsIHttpChannel_GetRedirectionLimit(This->http_channel, aRedirectionLimit);
+ FIXME("(%p)->(%p)\n", This, aRedirectionLimit);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%u)\n", This, aRedirectionLimit);
-
- if(This->http_channel)
- return nsIHttpChannel_SetRedirectionLimit(This->http_channel, aRedirectionLimit);
+ FIXME("(%p)->(%u)\n", This, aRedirectionLimit);
return NS_ERROR_NOT_IMPLEMENTED;
}
return NS_OK;
}
- if(This->http_channel)
- return nsIHttpChannel_GetResponseStatus(This->http_channel, aResponseStatus);
-
+ WARN("No response status\n");
return NS_ERROR_UNEXPECTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aResponseStatusText);
-
- if(This->http_channel)
- return nsIHttpChannel_GetResponseStatusText(This->http_channel, aResponseStatusText);
+ FIXME("(%p)->(%p)\n", This, aResponseStatusText);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aRequestSucceeded);
-
- if(This->http_channel)
- return nsIHttpChannel_GetRequestSucceeded(This->http_channel, aRequestSucceeded);
+ FIXME("(%p)->(%p)\n", This, aRequestSucceeded);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p %p)\n", This, header, _retval);
-
- if(This->http_channel)
- return nsIHttpChannel_GetResponseHeader(This->http_channel, header, _retval);
+ FIXME("(%p)->(%p %p)\n", This, header, _retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p %p %x)\n", This, header, value, merge);
-
- if(This->http_channel)
- return nsIHttpChannel_SetResponseHeader(This->http_channel, header, value, merge);
+ FIXME("(%p)->(%p %p %x)\n", This, header, value, merge);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, aVisitor);
-
- if(This->http_channel)
- return nsIHttpChannel_VisitResponseHeaders(This->http_channel, aVisitor);
+ FIXME("(%p)->(%p)\n", This, aVisitor);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, _retval);
-
- if(This->http_channel)
- return nsIHttpChannel_IsNoStoreResponse(This->http_channel, _retval);
+ FIXME("(%p)->(%p)\n", This, _retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSCHANNEL_THIS(iface);
- TRACE("(%p)->(%p)\n", This, _retval);
-
- if(This->http_channel)
- return nsIHttpChannel_IsNoCacheResponse(This->http_channel, _retval);
+ FIXME("(%p)->(%p)\n", This, _retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSUPCHANNEL_THIS(iface);
const char *content_type;
- nsresult nsres;
TRACE("(%p)->(%p %p %d)\n", This, aStream, aContentType, aContentLength);
if(aStream)
nsIInputStream_AddRef(aStream);
- if(This->post_data_stream) {
- nsIUploadChannel *upload_channel;
-
- nsres = nsIChannel_QueryInterface(This->channel, &IID_nsIUploadChannel,
- (void**)&upload_channel);
- if(NS_SUCCEEDED(nsres)) {
- nsres = nsIUploadChannel_SetUploadStream(upload_channel, aStream, aContentType, aContentLength);
- nsIUploadChannel_Release(upload_channel);
- if(NS_FAILED(nsres))
- WARN("SetUploadStream failed: %08x\n", nsres);
-
- }
- }
-
return NS_OK;
}
{
nsChannel *This = NSHTTPINTERNAL_THIS(iface);
- TRACE("(%p)->()\n", This);
+ FIXME("(%p)->()\n", This);
- if(This->http_channel_internal)
- return nsIHttpChannelInternal_GetDocumentURI(This->http_channel_internal, aDocumentURI);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSHTTPINTERNAL_THIS(iface);
- TRACE("(%p)->()\n", This);
+ FIXME("(%p)->()\n", This);
- if(This->http_channel_internal)
- return nsIHttpChannelInternal_SetDocumentURI(This->http_channel_internal, aDocumentURI);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSHTTPINTERNAL_THIS(iface);
- TRACE("(%p)->()\n", This);
+ FIXME("(%p)->()\n", This);
- if(This->http_channel_internal)
- return nsIHttpChannelInternal_GetRequestVersion(This->http_channel_internal, major, minor);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSHTTPINTERNAL_THIS(iface);
- TRACE("(%p)->()\n", This);
+ FIXME("(%p)->()\n", This);
- if(This->http_channel_internal)
- return nsIHttpChannelInternal_GetResponseVersion(This->http_channel_internal, major, minor);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSHTTPINTERNAL_THIS(iface);
- TRACE("(%p)->()\n", This);
+ FIXME("(%p)->()\n", This);
- if(This->http_channel_internal)
- return nsIHttpChannelInternal_SetCookie(This->http_channel_internal, aCookieHeader);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSHTTPINTERNAL_THIS(iface);
- TRACE("(%p)->()\n", This);
+ FIXME("(%p)->()\n", This);
- if(This->http_channel_internal)
- return nsIHttpChannelInternal_SetupFallbackChannel(This->http_channel_internal, aFallbackKey);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSHTTPINTERNAL_THIS(iface);
- TRACE("(%p)->()\n", This);
+ FIXME("(%p)->()\n", This);
- if(This->http_channel_internal)
- return nsIHttpChannelInternal_GetForceAllowThirdPartyCookie(This->http_channel_internal, aForceThirdPartyCookie);
return NS_ERROR_NOT_IMPLEMENTED;
}
{
nsChannel *This = NSHTTPINTERNAL_THIS(iface);
- TRACE("(%p)->()\n", This);
+ FIXME("(%p)->()\n", This);
- if(This->http_channel_internal)
- return nsIHttpChannelInternal_SetForceAllowThirdPartyCookie(This->http_channel_internal, aForceThirdPartyCookie);
return NS_ERROR_NOT_IMPLEMENTED;
}
nsHttpChannelInternal_SetForceAllowThirdPartyCookie
};
-#define NSURI_THIS(iface) DEFINE_THIS(nsURI, WineURI, iface)
+#define NSURI_THIS(iface) DEFINE_THIS(nsWineURI, IURL, iface)
-static nsresult NSAPI nsURI_QueryInterface(nsIWineURI *iface, nsIIDRef riid, nsQIResult result)
+static nsresult NSAPI nsURI_QueryInterface(nsIURL *iface, nsIIDRef riid, nsQIResult result)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
*result = NULL;
*result = NSURI(This);
}else if(IsEqualGUID(&IID_nsIURL, riid)) {
TRACE("(%p)->(IID_nsIURL %p)\n", This, result);
- *result = NSURI(This);
- }else if(IsEqualGUID(&IID_nsIWineURI, riid)) {
- TRACE("(%p)->(IID_nsIWineURI %p)\n", This, result);
- *result = NSURI(This);
+ *result = NSURL(This);
+ }else if(IsEqualGUID(&IID_nsWineURI, riid)) {
+ TRACE("(%p)->(IID_nsWineURI %p)\n", This, result);
+ *result = This;
}
if(*result) {
return This->uri ? nsIURI_QueryInterface(This->uri, riid, result) : NS_NOINTERFACE;
}
-static nsrefcnt NSAPI nsURI_AddRef(nsIWineURI *iface)
+static nsrefcnt NSAPI nsURI_AddRef(nsIURL *iface)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
-static nsrefcnt NSAPI nsURI_Release(nsIWineURI *iface)
+static nsrefcnt NSAPI nsURI_Release(nsIURL *iface)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
-static nsresult NSAPI nsURI_GetSpec(nsIWineURI *iface, nsACString *aSpec)
+static nsresult NSAPI nsURI_GetSpec(nsIURL *iface, nsACString *aSpec)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aSpec);
}
-static nsresult NSAPI nsURI_SetSpec(nsIWineURI *iface, const nsACString *aSpec)
+static nsresult NSAPI nsURI_SetSpec(nsIURL *iface, const nsACString *aSpec)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aSpec);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetPrePath(nsIWineURI *iface, nsACString *aPrePath)
+static nsresult NSAPI nsURI_GetPrePath(nsIURL *iface, nsACString *aPrePath)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aPrePath);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetScheme(nsIWineURI *iface, nsACString *aScheme)
+static nsresult NSAPI nsURI_GetScheme(nsIURL *iface, nsACString *aScheme)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aScheme);
- if(This->use_wine_url && strcmpW(This->wine_url, about_blankW)) {
+ if(This->use_wine_url) {
/*
* For Gecko we set scheme to unknown so it won't be handled
* as any special case.
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_SetScheme(nsIWineURI *iface, const nsACString *aScheme)
+static nsresult NSAPI nsURI_SetScheme(nsIURL *iface, const nsACString *aScheme)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aScheme);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetUserPass(nsIWineURI *iface, nsACString *aUserPass)
+static nsresult NSAPI nsURI_GetUserPass(nsIURL *iface, nsACString *aUserPass)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aUserPass);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_SetUserPass(nsIWineURI *iface, const nsACString *aUserPass)
+static nsresult NSAPI nsURI_SetUserPass(nsIURL *iface, const nsACString *aUserPass)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aUserPass);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetUsername(nsIWineURI *iface, nsACString *aUsername)
+static nsresult NSAPI nsURI_GetUsername(nsIURL *iface, nsACString *aUsername)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aUsername);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_SetUsername(nsIWineURI *iface, const nsACString *aUsername)
+static nsresult NSAPI nsURI_SetUsername(nsIURL *iface, const nsACString *aUsername)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aUsername);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetPassword(nsIWineURI *iface, nsACString *aPassword)
+static nsresult NSAPI nsURI_GetPassword(nsIURL *iface, nsACString *aPassword)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aPassword);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_SetPassword(nsIWineURI *iface, const nsACString *aPassword)
+static nsresult NSAPI nsURI_SetPassword(nsIURL *iface, const nsACString *aPassword)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aPassword);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetHostPort(nsIWineURI *iface, nsACString *aHostPort)
+static nsresult NSAPI nsURI_GetHostPort(nsIURL *iface, nsACString *aHostPort)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aHostPort);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_SetHostPort(nsIWineURI *iface, const nsACString *aHostPort)
+static nsresult NSAPI nsURI_SetHostPort(nsIURL *iface, const nsACString *aHostPort)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aHostPort);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetHost(nsIWineURI *iface, nsACString *aHost)
+static nsresult NSAPI nsURI_GetHost(nsIURL *iface, nsACString *aHost)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aHost);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_SetHost(nsIWineURI *iface, const nsACString *aHost)
+static nsresult NSAPI nsURI_SetHost(nsIURL *iface, const nsACString *aHost)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aHost);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetPort(nsIWineURI *iface, PRInt32 *aPort)
+static nsresult NSAPI nsURI_GetPort(nsIURL *iface, PRInt32 *aPort)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aPort);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_SetPort(nsIWineURI *iface, PRInt32 aPort)
+static nsresult NSAPI nsURI_SetPort(nsIURL *iface, PRInt32 aPort)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%d)\n", This, aPort);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetPath(nsIWineURI *iface, nsACString *aPath)
+static nsresult NSAPI nsURI_GetPath(nsIURL *iface, nsACString *aPath)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aPath);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_SetPath(nsIWineURI *iface, const nsACString *aPath)
+static nsresult NSAPI nsURI_SetPath(nsIURL *iface, const nsACString *aPath)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
const char *path;
nsACString_GetData(aPath, &path);
hres = UrlCombineW(This->wine_url, pathw, new_url, &size, 0);
heap_free(pathw);
if(SUCCEEDED(hres))
- nsIWineURI_SetWineURL(NSWINEURI(This), new_url);
+ set_wine_url(This, new_url);
else
WARN("UrlCombine failed: %08x\n", hres);
}
return nsIURI_SetPath(This->uri, aPath);
}
-static nsresult NSAPI nsURI_Equals(nsIWineURI *iface, nsIURI *other, PRBool *_retval)
+static nsresult NSAPI nsURI_Equals(nsIURL *iface, nsIURI *other, PRBool *_retval)
{
- nsURI *This = NSURI_THIS(iface);
- nsIWineURI *wine_uri;
- LPCWSTR other_url = NULL;
+ nsWineURI *This = NSURI_THIS(iface);
+ nsWineURI *wine_uri;
nsresult nsres;
TRACE("(%p)->(%p %p)\n", This, other, _retval);
if(This->uri)
return nsIURI_Equals(This->uri, other, _retval);
- nsres = nsIURI_QueryInterface(other, &IID_nsIWineURI, (void**)&wine_uri);
+ nsres = nsIURI_QueryInterface(other, &IID_nsWineURI, (void**)&wine_uri);
if(NS_FAILED(nsres)) {
- TRACE("Could not get nsIWineURI interface\n");
+ TRACE("Could not get nsWineURI interface\n");
*_retval = FALSE;
return NS_OK;
}
- nsIWineURI_GetWineURL(wine_uri, &other_url);
- *_retval = other_url && !UrlCompareW(This->wine_url, other_url, TRUE);
- nsIWineURI_Release(wine_uri);
+ *_retval = wine_uri->wine_url && !UrlCompareW(This->wine_url, wine_uri->wine_url, TRUE);
+ nsIURI_Release(NSURI(wine_uri));
return NS_OK;
}
-static nsresult NSAPI nsURI_SchemeIs(nsIWineURI *iface, const char *scheme, PRBool *_retval)
+static nsresult NSAPI nsURI_SchemeIs(nsIURL *iface, const char *scheme, PRBool *_retval)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_a(scheme), _retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_Clone(nsIWineURI *iface, nsIURI **_retval)
+static nsresult NSAPI nsURI_Clone(nsIURL *iface, nsIURI **_retval)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
nsIURI *nsuri = NULL;
- nsIWineURI *wine_uri;
+ nsWineURI *wine_uri;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, _retval);
return nsres;
}
- *_retval = (nsIURI*)wine_uri;
- return nsIWineURI_SetWineURL(wine_uri, This->wine_url);
+ set_wine_url(wine_uri, This->wine_url);
+
+ *_retval = NSURI(wine_uri);
+ return NS_OK;
}
-static nsresult NSAPI nsURI_Resolve(nsIWineURI *iface, const nsACString *arelativePath,
+static nsresult NSAPI nsURI_Resolve(nsIURL *iface, const nsACString *arelativePath,
nsACString *_retval)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p %p)\n", This, arelativePath, _retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetAsciiSpec(nsIWineURI *iface, nsACString *aAsciiSpec)
+static nsresult NSAPI nsURI_GetAsciiSpec(nsIURL *iface, nsACString *aAsciiSpec)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aAsciiSpec);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetAsciiHost(nsIWineURI *iface, nsACString *aAsciiHost)
+static nsresult NSAPI nsURI_GetAsciiHost(nsIURL *iface, nsACString *aAsciiHost)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aAsciiHost);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetOriginCharset(nsIWineURI *iface, nsACString *aOriginCharset)
+static nsresult NSAPI nsURI_GetOriginCharset(nsIURL *iface, nsACString *aOriginCharset)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aOriginCharset);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetFilePath(nsIWineURI *iface, nsACString *aFilePath)
+static nsresult NSAPI nsURL_GetFilePath(nsIURL *iface, nsACString *aFilePath)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aFilePath);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_SetFilePath(nsIWineURI *iface, const nsACString *aFilePath)
+static nsresult NSAPI nsURL_SetFilePath(nsIURL *iface, const nsACString *aFilePath)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aFilePath));
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetParam(nsIWineURI *iface, nsACString *aParam)
+static nsresult NSAPI nsURL_GetParam(nsIURL *iface, nsACString *aParam)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aParam);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_SetParam(nsIWineURI *iface, const nsACString *aParam)
+static nsresult NSAPI nsURL_SetParam(nsIURL *iface, const nsACString *aParam)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aParam));
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetQuery(nsIWineURI *iface, nsACString *aQuery)
+static nsresult NSAPI nsURL_GetQuery(nsIURL *iface, nsACString *aQuery)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aQuery);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_SetQuery(nsIWineURI *iface, const nsACString *aQuery)
+static nsresult NSAPI nsURL_SetQuery(nsIURL *iface, const nsACString *aQuery)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
const WCHAR *ptr1, *ptr2;
const char *query;
WCHAR *new_url, *ptr;
return NS_OK;
}
-static nsresult NSAPI nsURL_GetRef(nsIWineURI *iface, nsACString *aRef)
+static nsresult NSAPI nsURL_GetRef(nsIURL *iface, nsACString *aRef)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aRef);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_SetRef(nsIWineURI *iface, const nsACString *aRef)
+static nsresult NSAPI nsURL_SetRef(nsIURL *iface, const nsACString *aRef)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
const char *refa;
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aRef));
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetDirectory(nsIWineURI *iface, nsACString *aDirectory)
+static nsresult NSAPI nsURL_GetDirectory(nsIURL *iface, nsACString *aDirectory)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aDirectory);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_SetDirectory(nsIWineURI *iface, const nsACString *aDirectory)
+static nsresult NSAPI nsURL_SetDirectory(nsIURL *iface, const nsACString *aDirectory)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aDirectory));
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetFileName(nsIWineURI *iface, nsACString *aFileName)
+static nsresult NSAPI nsURL_GetFileName(nsIURL *iface, nsACString *aFileName)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aFileName);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_SetFileName(nsIWineURI *iface, const nsACString *aFileName)
+static nsresult NSAPI nsURL_SetFileName(nsIURL *iface, const nsACString *aFileName)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aFileName));
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetFileBaseName(nsIWineURI *iface, nsACString *aFileBaseName)
+static nsresult NSAPI nsURL_GetFileBaseName(nsIURL *iface, nsACString *aFileBaseName)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aFileBaseName);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_SetFileBaseName(nsIWineURI *iface, const nsACString *aFileBaseName)
+static nsresult NSAPI nsURL_SetFileBaseName(nsIURL *iface, const nsACString *aFileBaseName)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aFileBaseName));
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetFileExtension(nsIWineURI *iface, nsACString *aFileExtension)
+static nsresult NSAPI nsURL_GetFileExtension(nsIURL *iface, nsACString *aFileExtension)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p)\n", This, aFileExtension);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_SetFileExtension(nsIWineURI *iface, const nsACString *aFileExtension)
+static nsresult NSAPI nsURL_SetFileExtension(nsIURL *iface, const nsACString *aFileExtension)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%s)\n", This, debugstr_nsacstr(aFileExtension));
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetCommonBaseSpec(nsIWineURI *iface, nsIURI *aURIToCompare, nsACString *_retval)
+static nsresult NSAPI nsURL_GetCommonBaseSpec(nsIURL *iface, nsIURI *aURIToCompare, nsACString *_retval)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p %p)\n", This, aURIToCompare, _retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURL_GetRelativeSpec(nsIWineURI *iface, nsIURI *aURIToCompare, nsACString *_retval)
+static nsresult NSAPI nsURL_GetRelativeSpec(nsIURL *iface, nsIURI *aURIToCompare, nsACString *_retval)
{
- nsURI *This = NSURI_THIS(iface);
+ nsWineURI *This = NSURI_THIS(iface);
TRACE("(%p)->(%p %p)\n", This, aURIToCompare, _retval);
return NS_ERROR_NOT_IMPLEMENTED;
}
-static nsresult NSAPI nsURI_GetNSContainer(nsIWineURI *iface, NSContainer **aContainer)
-{
- nsURI *This = NSURI_THIS(iface);
-
- TRACE("(%p)->(%p)\n", This, aContainer);
-
- if(This->container)
- nsIWebBrowserChrome_AddRef(NSWBCHROME(This->container));
- *aContainer = This->container;
-
- return NS_OK;
-}
-
-static nsresult NSAPI nsURI_SetNSContainer(nsIWineURI *iface, NSContainer *aContainer)
-{
- nsURI *This = NSURI_THIS(iface);
-
- TRACE("(%p)->(%p)\n", This, aContainer);
-
- if(This->container) {
- if(This->container == aContainer)
- return NS_OK;
- TRACE("Changing %p -> %p\n", This->container, aContainer);
- nsIWebBrowserChrome_Release(NSWBCHROME(This->container));
- }
-
- if(aContainer)
- nsIWebBrowserChrome_AddRef(NSWBCHROME(aContainer));
- This->container = aContainer;
-
- return NS_OK;
-}
-
-static nsresult NSAPI nsURI_GetWindow(nsIWineURI *iface, HTMLWindow **aHTMLWindow)
-{
- nsURI *This = NSURI_THIS(iface);
-
- TRACE("(%p)->(%p)\n", This, aHTMLWindow);
-
- if(This->window_ref && This->window_ref->window) {
- IHTMLWindow2_AddRef(HTMLWINDOW2(This->window_ref->window));
- *aHTMLWindow = This->window_ref->window;
- }else {
- *aHTMLWindow = NULL;
- }
-
- return NS_OK;
-}
-
-static nsresult NSAPI nsURI_SetWindow(nsIWineURI *iface, HTMLWindow *aHTMLWindow)
-{
- nsURI *This = NSURI_THIS(iface);
-
- TRACE("(%p)->(%p)\n", This, aHTMLWindow);
-
- if(This->window_ref) {
- if(This->window_ref->window == aHTMLWindow)
- return NS_OK;
- TRACE("Changing %p -> %p\n", This->window_ref->window, aHTMLWindow);
- windowref_release(This->window_ref);
- }
-
- if(aHTMLWindow) {
- windowref_addref(aHTMLWindow->window_ref);
- This->window_ref = aHTMLWindow->window_ref;
-
- if(aHTMLWindow->doc_obj)
- nsIWineURI_SetNSContainer(NSWINEURI(This), aHTMLWindow->doc_obj->nscontainer);
- }else {
- This->window_ref = NULL;
- }
-
- return NS_OK;
-}
-
-static nsresult NSAPI nsURI_GetIsDocumentURI(nsIWineURI *iface, PRBool *aIsDocumentURI)
-{
- nsURI *This = NSURI_THIS(iface);
-
- TRACE("(%p)->(%p)\n", This, aIsDocumentURI);
-
- *aIsDocumentURI = This->is_doc_uri;
- return NS_OK;
-}
-
-static nsresult NSAPI nsURI_SetIsDocumentURI(nsIWineURI *iface, PRBool aIsDocumentURI)
-{
- nsURI *This = NSURI_THIS(iface);
-
- TRACE("(%p)->(%x)\n", This, aIsDocumentURI);
-
- This->is_doc_uri = aIsDocumentURI;
- return NS_OK;
-}
-
-static nsresult NSAPI nsURI_GetWineURL(nsIWineURI *iface, LPCWSTR *aURL)
-{
- nsURI *This = NSURI_THIS(iface);
-
- TRACE("(%p)->(%p)\n", This, aURL);
-
- *aURL = This->wine_url;
- return NS_OK;
-}
-
-static nsresult NSAPI nsURI_SetWineURL(nsIWineURI *iface, LPCWSTR aURL)
-{
- nsURI *This = NSURI_THIS(iface);
-
- static const WCHAR wszFtp[] = {'f','t','p',':'};
- static const WCHAR wszHttp[] = {'h','t','t','p',':'};
- static const WCHAR wszHttps[] = {'h','t','t','p','s',':'};
-
- TRACE("(%p)->(%s)\n", This, debugstr_w(aURL));
-
- heap_free(This->wine_url);
-
- if(aURL) {
- int len = strlenW(aURL)+1;
- This->wine_url = heap_alloc(len*sizeof(WCHAR));
- memcpy(This->wine_url, aURL, len*sizeof(WCHAR));
-
- /* FIXME: Always use wine url */
- This->use_wine_url =
- strncmpW(aURL, wszFtp, sizeof(wszFtp)/sizeof(WCHAR))
- && strncmpW(aURL, wszHttp, sizeof(wszHttp)/sizeof(WCHAR))
- && strncmpW(aURL, wszHttps, sizeof(wszHttps)/sizeof(WCHAR));
- }else {
- This->wine_url = NULL;
- This->use_wine_url = FALSE;
- }
-
- return NS_OK;
-}
-
#undef NSURI_THIS
-static const nsIWineURIVtbl nsWineURIVtbl = {
+static const nsIURLVtbl nsURLVtbl = {
nsURI_QueryInterface,
nsURI_AddRef,
nsURI_Release,
nsURL_GetFileExtension,
nsURL_SetFileExtension,
nsURL_GetCommonBaseSpec,
- nsURL_GetRelativeSpec,
- nsURI_GetNSContainer,
- nsURI_SetNSContainer,
- nsURI_GetWindow,
- nsURI_SetWindow,
- nsURI_GetIsDocumentURI,
- nsURI_SetIsDocumentURI,
- nsURI_GetWineURL,
- nsURI_SetWineURL
+ nsURL_GetRelativeSpec
};
-static nsresult create_uri(nsIURI *uri, HTMLWindow *window, NSContainer *container, nsIWineURI **_retval)
+static nsresult create_uri(nsIURI *uri, HTMLWindow *window, NSContainer *container, nsWineURI **_retval)
{
- nsURI *ret = heap_alloc_zero(sizeof(nsURI));
+ nsWineURI *ret = heap_alloc_zero(sizeof(nsWineURI));
- ret->lpWineURIVtbl = &nsWineURIVtbl;
+ ret->lpIURLVtbl = &nsURLVtbl;
ret->ref = 1;
ret->uri = uri;
- nsIWineURI_SetNSContainer(NSWINEURI(ret), container);
- nsIWineURI_SetWindow(NSWINEURI(ret), window);
+ set_uri_nscontainer(ret, container);
+ set_uri_window(ret, window);
if(uri)
nsIURI_QueryInterface(uri, &IID_nsIURL, (void**)&ret->nsurl);
- else
- ret->nsurl = NULL;
TRACE("retval=%p\n", ret);
- *_retval = NSWINEURI(ret);
+ *_retval = ret;
return NS_OK;
}
+HRESULT create_doc_uri(HTMLWindow *window, WCHAR *url, nsWineURI **ret)
+{
+ nsWineURI *uri;
+ nsresult nsres;
+
+ nsres = create_uri(NULL, window, window->doc_obj->nscontainer, &uri);
+ if(NS_FAILED(nsres))
+ return E_FAIL;
+
+ set_wine_url(uri, url);
+ uri->is_doc_uri = TRUE;
+
+ *ret = uri;
+ return S_OK;
+}
+
typedef struct {
const nsIProtocolHandlerVtbl *lpProtocolHandlerVtbl;
static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *aSpec,
const char *aOriginCharset, nsIURI *aBaseURI, nsIURI **_retval)
{
+ nsWineURI *wine_uri, *base_wine_uri = NULL;
const char *spec = NULL;
HTMLWindow *window = NULL;
nsIURI *uri = NULL;
LPCWSTR base_wine_url = NULL;
- nsIWineURI *base_wine_uri = NULL, *wine_uri;
BOOL is_wine_uri = FALSE;
nsresult nsres;
}
if(aBaseURI) {
- nsACString base_uri_str;
- const char *base_uri = NULL;
+ PARSEDURLA parsed_url = {sizeof(PARSEDURLA)};
- nsACString_Init(&base_uri_str, NULL);
-
- nsres = nsIURI_GetSpec(aBaseURI, &base_uri_str);
+ nsres = nsIURI_QueryInterface(aBaseURI, &IID_nsWineURI, (void**)&base_wine_uri);
if(NS_SUCCEEDED(nsres)) {
- nsACString_GetData(&base_uri_str, &base_uri);
- TRACE("base_uri=%s\n", debugstr_a(base_uri));
+ base_wine_url = base_wine_uri->wine_url;
+ if(base_wine_uri->window_ref && base_wine_uri->window_ref->window) {
+ window = base_wine_uri->window_ref->window;
+ IHTMLWindow2_AddRef(HTMLWINDOW2(window));
+ }
+ TRACE("base url: %s window: %p\n", debugstr_w(base_wine_url), window);
+ }else if(FAILED(ParseURLA(spec, &parsed_url))) {
+ TRACE("not wraping\n");
+ return nsIIOService_NewURI(nsio, aSpec, aOriginCharset, aBaseURI, _retval);
}else {
- ERR("GetSpec failed: %08x\n", nsres);
+ WARN("Could not get base nsWineURI: %08x\n", nsres);
}
-
- nsACString_Finish(&base_uri_str);
}
nsres = nsIIOService_NewURI(nsio, aSpec, aOriginCharset, aBaseURI, &uri);
if(NS_FAILED(nsres))
TRACE("NewURI failed: %08x\n", nsres);
- if(aBaseURI) {
- nsres = nsIURI_QueryInterface(aBaseURI, &IID_nsIWineURI, (void**)&base_wine_uri);
- if(NS_SUCCEEDED(nsres)) {
- nsIWineURI_GetWindow(base_wine_uri, &window);
- nsIWineURI_GetWineURL(base_wine_uri, &base_wine_url);
- }else {
- TRACE("Could not get base nsIWineURI: %08x\n", nsres);
- }
- }
-
- TRACE("window = %p\n", window);
-
nsres = create_uri(uri, window, NULL, &wine_uri);
*_retval = (nsIURI*)wine_uri;
URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
url, sizeof(url)/sizeof(WCHAR), &len, 0);
if(SUCCEEDED(hres))
- nsIWineURI_SetWineURL(wine_uri, url);
+ set_wine_url(wine_uri, url);
else
WARN("CoCombineUrl failed: %08x\n", hres);
}else if(is_wine_uri) {
WCHAR url[INTERNET_MAX_URL_LENGTH];
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)
- nsIWineURI_Release(base_wine_uri);
+ nsIURI_Release(NSURI(base_wine_uri));
return nsres;
}
static nsresult NSAPI nsIOService_NewChannelFromURI(nsIIOService *iface, nsIURI *aURI,
nsIChannel **_retval)
{
- nsIChannel *channel = NULL;
+ PARSEDURLW parsed_url = {sizeof(PARSEDURLW)};
nsChannel *ret;
- nsIWineURI *wine_uri;
+ nsWineURI *wine_uri;
nsresult nsres;
TRACE("(%p %p)\n", aURI, _retval);
- nsres = nsIIOService_NewChannelFromURI(nsio, aURI, &channel);
- if(NS_FAILED(nsres) && nsres != NS_ERROR_UNKNOWN_PROTOCOL) {
- WARN("NewChannelFromURI failed: %08x\n", nsres);
- *_retval = channel;
- return nsres;
- }
-
- nsres = nsIURI_QueryInterface(aURI, &IID_nsIWineURI, (void**)&wine_uri);
+ nsres = nsIURI_QueryInterface(aURI, &IID_nsWineURI, (void**)&wine_uri);
if(NS_FAILED(nsres)) {
- WARN("Could not get nsIWineURI: %08x\n", nsres);
- *_retval = channel;
- return channel ? NS_OK : NS_ERROR_UNEXPECTED;
+ TRACE("Could not get nsWineURI: %08x\n", nsres);
+ return nsIIOService_NewChannelFromURI(nsio, aURI, _retval);
}
ret = heap_alloc_zero(sizeof(nsChannel));
ret->lpUploadChannelVtbl = &nsUploadChannelVtbl;
ret->lpIHttpChannelInternalVtbl = &nsHttpChannelInternalVtbl;
ret->ref = 1;
- ret->channel = channel;
ret->uri = wine_uri;
nsIURI_AddRef(aURI);
ret->original_uri = aURI;
-
- if(channel) {
- nsIChannel_QueryInterface(channel, &IID_nsIHttpChannel, (void**)&ret->http_channel);
- nsIChannel_QueryInterface(channel, &IID_nsIHttpChannelInternal, (void**)&ret->http_channel_internal);
- }
+ 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;