/***************************************************************************** * Main entry point. This is a console application so we have a wmain() not a * winmain(). */ int wmain(int argc, WCHAR *argv[]) { static const WCHAR nohomeW[] = {'-','n','o','h','o','m','e',0}; WCHAR *url = argv[1]; BSTR display_uri; DWORD scheme; IUri *uri; HRESULT hres; int ret = 1; /* DDE used only if -nohome is specified; avoids delay in printing usage info * when no parameters are passed */ if (url && !strcmpiW( url, nohomeW )) url = argc > 2 ? argv[2] : get_url_from_dde(); if (!url) { WINE_ERR( "Usage: winebrowser URL\n" ); return -1; } hres = CreateUri(url, Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|Uri_CREATE_FILE_USE_DOS_PATH, 0, &uri); if(FAILED(hres)) { WINE_ERR("Failed to parse URL\n"); ret = open_http_url(url); HeapFree(GetProcessHeap(), 0, ddeString); return ret; } HeapFree(GetProcessHeap(), 0, ddeString); IUri_GetScheme(uri, &scheme); if(scheme == URL_SCHEME_FILE) { IUri *file_uri; file_uri = convert_file_uri(uri); if(file_uri) { IUri_Release(uri); uri = file_uri; }else { WINE_ERR("Failed to convert file URL to unix path\n"); } } hres = IUri_GetDisplayUri(uri, &display_uri); IUri_Release(uri); if(FAILED(hres)) return -1; WINE_TRACE("opening %s\n", wine_dbgstr_w(display_uri)); if(scheme == URL_SCHEME_MAILTO) ret = open_mailto_url(display_uri); else /* let the browser decide how to handle the given url */ ret = open_http_url(display_uri); SysFreeString(display_uri); return ret; }
void set_current_uri(HTMLOuterWindow *window, IUri *uri) { if(window->uri) { IUri_Release(window->uri); window->uri = NULL; } if(window->uri_nofrag) { IUri_Release(window->uri_nofrag); window->uri_nofrag = NULL; } SysFreeString(window->url); window->url = NULL; if(!uri) return; IUri_AddRef(uri); window->uri = uri; window->uri_nofrag = get_uri_nofrag(uri); if(!window->uri_nofrag) { FIXME("get_uri_nofrag failed\n"); IUri_AddRef(uri); window->uri_nofrag = uri; } IUri_GetDisplayUri(uri, &window->url); }
static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm) { URLMoniker *This = impl_from_IMoniker(iface); WCHAR *new_uri_str; IUri *new_uri; BSTR new_url; ULONG size; ULONG got; HRESULT hres; TRACE("(%p,%p)\n",This,pStm); if(!pStm) return E_INVALIDARG; /* * NOTE * Writes a ULONG containing length of unicode string, followed * by that many unicode characters */ hres = IStream_Read(pStm, &size, sizeof(ULONG), &got); if(FAILED(hres)) return hres; if(got != sizeof(ULONG)) return E_FAIL; new_uri_str = heap_alloc(size+sizeof(WCHAR)); if(!new_uri_str) return E_OUTOFMEMORY; hres = IStream_Read(pStm, new_uri_str, size, NULL); new_uri_str[size/sizeof(WCHAR)] = 0; if(SUCCEEDED(hres)) hres = CreateUri(new_uri_str, 0, 0, &new_uri); heap_free(new_uri_str); if(FAILED(hres)) return hres; hres = IUri_GetDisplayUri(new_uri, &new_url); if(FAILED(hres)) { IUri_Release(new_uri); return hres; } SysFreeString(This->URLName); if(This->uri) IUri_Release(This->uri); This->uri = new_uri; This->URLName = new_url; return S_OK; }
/*********************************************************************** * CreateURLMonikerEx (URLMON.@) * * Create a url moniker. * * PARAMS * pmkContext [I] Context * szURL [I] Url to create the moniker for * ppmk [O] Destination for created moniker. * dwFlags [I] Flags. * * RETURNS * Success: S_OK. ppmk contains the created IMoniker object. * Failure: MK_E_SYNTAX if szURL is not a valid url, or * E_OUTOFMEMORY if memory allocation fails. */ HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk, DWORD dwFlags) { IUri *uri, *base_uri = NULL; URLMoniker *obj; HRESULT hres; TRACE("(%p, %s, %p, %08x)\n", pmkContext, debugstr_w(szURL), ppmk, dwFlags); if (ppmk) *ppmk = NULL; if (!szURL || !ppmk) return E_INVALIDARG; if(dwFlags >= ARRAY_SIZE(create_flags_map)) { FIXME("Unsupported flags %x\n", dwFlags); return E_INVALIDARG; } if(pmkContext) { IUriContainer *uri_container; hres = IMoniker_QueryInterface(pmkContext, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &base_uri); IUriContainer_Release(uri_container); if(FAILED(hres)) return hres; } } if(base_uri) { hres = CoInternetCombineUrlEx(base_uri, szURL, combine_flags_map[dwFlags], &uri, 0); IUri_Release(base_uri); }else { hres = CreateUri(szURL, Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME|create_flags_map[dwFlags], 0, &uri); } if(FAILED(hres)) return hres; hres = create_moniker(uri, &obj); IUri_Release(uri); if(FAILED(hres)) return hres; *ppmk = &obj->IMoniker_iface; return S_OK; }
/*********************************************************************** * CreateURLMonikerEx2 (URLMON.@) */ HRESULT WINAPI CreateURLMonikerEx2(IMoniker *pmkContext, IUri *pUri, IMoniker **ppmk, DWORD dwFlags) { IUri *context_uri = NULL, *uri; IUriContainer *uri_container; URLMoniker *ret; HRESULT hres; TRACE("(%p %p %p %x)\n", pmkContext, pUri, ppmk, dwFlags); if (ppmk) *ppmk = NULL; if (!pUri || !ppmk) return E_INVALIDARG; if(dwFlags >= ARRAY_SIZE(create_flags_map)) { FIXME("Unsupported flags %x\n", dwFlags); return E_INVALIDARG; } if(pmkContext) { hres = IMoniker_QueryInterface(pmkContext, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &context_uri); if(FAILED(hres)) context_uri = NULL; IUriContainer_Release(uri_container); } } if(context_uri) { hres = CoInternetCombineIUri(context_uri, pUri, combine_flags_map[dwFlags], &uri, 0); IUri_Release(context_uri); if(FAILED(hres)) return hres; }else { uri = pUri; IUri_AddRef(uri); } hres = create_moniker(uri, &ret); IUri_Release(uri); if(FAILED(hres)) return hres; *ppmk = &ret->IMoniker_iface; return S_OK; }
static HRESULT WINAPI FtpProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { FtpProtocol *This = PROTOCOL_THIS(iface); IUri *uri; HRESULT hres; static const WCHAR ftpW[] = {'f','t','p',':'}; TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); if(strncmpW(szUrl, ftpW, sizeof(ftpW)/sizeof(WCHAR))) return MK_E_SYNTAX; hres = CreateUri(szUrl, 0, 0, &uri); if(FAILED(hres)) return hres; hres = protocol_start(&This->base, PROTOCOL(This), uri, pOIProtSink, pOIBindInfo); IUri_Release(uri); return hres; }
static HRESULT navigate_anchor_window(HTMLAnchorElement *This, const WCHAR *target) { nsAString href_str; IUri *uri; nsresult nsres; HRESULT hres; nsAString_Init(&href_str, NULL); nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str); if(NS_SUCCEEDED(nsres)) { const PRUnichar *href; nsAString_GetData(&href_str, &href); hres = create_relative_uri(This->element.node.doc->basedoc.window, href, &uri); }else { ERR("Could not get anchor href: %08x\n", nsres); hres = E_FAIL; } nsAString_Finish(&href_str); if(FAILED(hres)) return hres; hres = navigate_new_window(This->element.node.doc->basedoc.window, uri, target, NULL); IUri_Release(uri); return hres; }
void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags) { IUriContainer *uri_container; IUri *uri = NULL; HRESULT hres; if(This->mon) { if(This->doc_obj && !(flags & (BINDING_REPLACE|BINDING_REFRESH))) { if(This == This->doc_obj->basedoc.window) notify_travellog_update(This->doc_obj); else TRACE("Skipping travellog update for frame navigation.\n"); } IMoniker_Release(This->mon); This->mon = NULL; } This->load_flags = flags; if(!mon) return; IMoniker_AddRef(mon); This->mon = mon; hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &uri); IUriContainer_Release(uri_container); if(hres != S_OK) { WARN("GetIUri failed: %08x\n", hres); uri = NULL; } } if(!uri) { WCHAR *url; hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url); if(SUCCEEDED(hres)) { hres = create_uri(url, 0, &uri); if(FAILED(hres)) { WARN("CrateUri failed: %08x\n", hres); set_current_uri(This, NULL); This->url = SysAllocString(url); CoTaskMemFree(url); return; } CoTaskMemFree(url); }else { WARN("GetDisplayName failed: %08x\n", hres); } } set_current_uri(This, uri); if(uri) IUri_Release(uri); set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); }
static void release_install_ctx(install_ctx_t *ctx) { if(ctx->uri) IUri_Release(ctx->uri); if(ctx->callback) IBindStatusCallback_Release(ctx->callback); heap_free(ctx->install_file); heap_free(ctx); }
static HRESULT WINAPI PersistHistory_LoadHistory(IPersistHistory *iface, IStream *pStream, IBindCtx *pbc) { HTMLDocument *This = impl_from_IPersistHistory(iface); ULONG str_len, read; WCHAR *uri_str; IUri *uri; HRESULT hres; TRACE("(%p)->(%p %p)\n", This, pStream, pbc); if(!This->window) { FIXME("No current window\n"); return E_UNEXPECTED; } if(pbc) FIXME("pbc not supported\n"); if(This->doc_obj->client) { IOleCommandTarget *cmdtrg = NULL; hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget, (void**)&cmdtrg); if(SUCCEEDED(hres)) { IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 138, 0, NULL, NULL); IOleCommandTarget_Release(cmdtrg); } } hres = IStream_Read(pStream, &str_len, sizeof(str_len), &read); if(FAILED(hres)) return hres; if(read != sizeof(str_len)) return E_FAIL; uri_str = heap_alloc((str_len+1)*sizeof(WCHAR)); if(!uri_str) return E_OUTOFMEMORY; hres = IStream_Read(pStream, uri_str, str_len*sizeof(WCHAR), &read); if(SUCCEEDED(hres) && read != str_len*sizeof(WCHAR)) hres = E_FAIL; if(SUCCEEDED(hres)) { uri_str[str_len] = 0; hres = create_uri(uri_str, 0, &uri); } heap_free(uri_str); if(FAILED(hres)) return hres; hres = load_uri(This->window, uri, BINDING_FROMHIST); IUri_Release(uri); return hres; }
void set_current_mon(HTMLOuterWindow *This, IMoniker *mon) { IUriContainer *uri_container; IUri *uri = NULL; HRESULT hres; if(This->mon) { if(This->doc_obj) notify_travellog_update(This->doc_obj); IMoniker_Release(This->mon); This->mon = NULL; } if(!mon) return; IMoniker_AddRef(mon); This->mon = mon; hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &uri); IUriContainer_Release(uri_container); if(hres != S_OK) { WARN("GetIUri failed: %08x\n", hres); uri = NULL; } } if(!uri) { WCHAR *url; hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url); if(SUCCEEDED(hres)) { hres = CreateUri(url, 0, 0, &uri); if(FAILED(hres)) { WARN("CrateUri failed: %08x\n", hres); set_current_uri(This, NULL); This->url = SysAllocString(url); CoTaskMemFree(url); return; } CoTaskMemFree(url); }else { WARN("GetDisplayName failed: %08x\n", hres); } } set_current_uri(This, uri); if(uri) IUri_Release(uri); set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); }
HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon) { HRESULT hr; IUri *uri; TRACE("%s\n", debugstr_w(url)); if (FAILED(hr = create_uri(url, &uri))) return hr; hr = CreateURLMonikerEx2(NULL, uri, mon, 0); IUri_Release(uri); return hr; }
static HRESULT navigate_href_new_window(HTMLElement *element, nsAString *href_str, const WCHAR *target) { const PRUnichar *href; IUri *uri; HRESULT hres; nsAString_GetData(href_str, &href); hres = create_relative_uri(element->node.doc->basedoc.window, href, &uri); if(FAILED(hres)) return hres; hres = navigate_new_window(element->node.doc->basedoc.window, uri, target, NULL, NULL); IUri_Release(uri); return hres; }
void set_current_uri(HTMLOuterWindow *window, IUri *uri) { if(window->uri) { IUri_Release(window->uri); window->uri = NULL; } SysFreeString(window->url); window->url = NULL; if(!uri) return; IUri_AddRef(uri); window->uri = uri; IUri_GetDisplayUri(uri, &window->url); }
static ULONG WINAPI URLMoniker_Release(IMoniker *iface) { URLMoniker *This = impl_from_IMoniker(iface); ULONG refCount = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%u\n",This, refCount); if (!refCount) { if(This->uri) IUri_Release(This->uri); SysFreeString(This->URLName); heap_free(This); URLMON_UnlockModule(); } return refCount; }
static HRESULT WINAPI GopherProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { GopherProtocol *This = PROTOCOL_THIS(iface); IUri *uri; HRESULT hres; TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); hres = CreateUri(szUrl, 0, 0, &uri); if(FAILED(hres)) return hres; hres = protocol_start(&This->base, PROTOCOL(This), uri, pOIProtSink, pOIBindInfo); IUri_Release(uri); return hres; }
static HRESULT WINAPI FtpProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { FtpProtocol *This = impl_from_IInternetProtocolEx(iface); IUri *uri; HRESULT hres; TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); hres = CreateUri(szUrl, 0, 0, &uri); if(FAILED(hres)) return hres; hres = IInternetProtocolEx_StartEx(&This->IInternetProtocolEx_iface, uri, pOIProtSink, pOIBindInfo, grfPI, (HANDLE*)dwReserved); IUri_Release(uri); return hres; }
static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface) { BindProtocol *This = impl_from_IInternetProtocolEx(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); if(!ref) { if(This->wininet_info) IWinInetInfo_Release(This->wininet_info); if(This->wininet_http_info) IWinInetHttpInfo_Release(This->wininet_http_info); if(This->protocol) IInternetProtocol_Release(This->protocol); if(This->bind_info) IInternetBindInfo_Release(This->bind_info); if(This->protocol_handler && This->protocol_handler != &This->default_protocol_handler.IInternetProtocol_iface) IInternetProtocol_Release(This->protocol_handler); if(This->protocol_sink_handler && This->protocol_sink_handler != &This->default_protocol_handler.IInternetProtocolSink_iface) IInternetProtocolSink_Release(This->protocol_sink_handler); if(This->uri) IUri_Release(This->uri); SysFreeString(This->display_uri); set_binding_sink(This, NULL, NULL); if(This->notif_hwnd) release_notif_hwnd(This->notif_hwnd); This->section.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&This->section); heap_free(This->mime); heap_free(This); URLMON_UnlockModule(); } return ref; }
HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download) { download_proc_task_t *download_task; HTMLDocumentObj *doc_obj = NULL; nsChannelBSC *bscallback; nsWineURI *nsuri; LPOLESTR url; IUri *uri; HRESULT hres; if(window->doc_obj && window->doc_obj->basedoc.window == window) doc_obj = window->doc_obj; hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url); if(FAILED(hres)) { WARN("GetDiaplayName failed: %08x\n", hres); return hres; } if(nav_uri) { uri = nav_uri; }else { hres = create_uri(url, 0, &uri); if(FAILED(hres)) { CoTaskMemFree(url); return hres; } } TRACE("got url: %s\n", debugstr_w(url)); set_ready_state(window, READYSTATE_LOADING); hres = create_doc_uri(window, uri, &nsuri); if(!nav_uri) IUri_Release(uri); if(SUCCEEDED(hres)) { if(async_bsc) bscallback = async_bsc; else hres = create_channelbsc(mon, NULL, NULL, 0, TRUE, &bscallback); } if(SUCCEEDED(hres)) { if(window->base.inner_window->doc) remove_target_tasks(window->base.inner_window->task_magic); abort_window_bindings(window->base.inner_window); hres = load_nsuri(window, nsuri, bscallback, LOAD_FLAGS_BYPASS_CACHE); nsISupports_Release((nsISupports*)nsuri); /* FIXME */ if(SUCCEEDED(hres)) { hres = create_pending_window(window, bscallback); TRACE("pending window for %p %p %p\n", window, bscallback, window->pending_window); } if(bscallback != async_bsc) IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface); } if(FAILED(hres)) { CoTaskMemFree(url); return hres; } if(doc_obj) { HTMLDocument_LockContainer(doc_obj, TRUE); if(doc_obj->frame) { docobj_task_t *task; task = heap_alloc(sizeof(docobj_task_t)); task->doc = doc_obj; hres = push_task(&task->header, set_progress_proc, NULL, doc_obj->basedoc.task_magic); if(FAILED(hres)) { CoTaskMemFree(url); return hres; } } download_task = heap_alloc(sizeof(download_proc_task_t)); download_task->doc = doc_obj; download_task->set_download = set_download; download_task->url = url; return push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, doc_obj->basedoc.task_magic); } return S_OK; }
static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface) { HTMLFormElement *This = impl_from_IHTMLFormElement(iface); HTMLOuterWindow *window = NULL, *this_window = NULL; nsIInputStream *post_stream; nsAString action_uri_str, target_str; IUri *uri; nsresult nsres; HRESULT hres; TRACE("(%p)->()\n", This); if(This->element.node.doc) { HTMLDocumentNode *doc = This->element.node.doc; if(doc->window && doc->window->base.outer_window) this_window = doc->window->base.outer_window; } if(!this_window) { TRACE("No outer window\n"); return S_OK; } nsAString_Init(&target_str, NULL); nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &target_str); if(NS_SUCCEEDED(nsres)) { BOOL use_new_window; window = get_target_window(this_window, &target_str, &use_new_window); if(use_new_window) FIXME("submit to new window is not supported\n"); } nsAString_Finish(&target_str); if(!window) return S_OK; /* * FIXME: We currently don't use our submit implementation for sub-windows because * load_nsuri can't support post data. We should fix it. */ if(!window->doc_obj || window->doc_obj->basedoc.window != window) { nsres = nsIDOMHTMLFormElement_Submit(This->nsform); IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(NS_FAILED(nsres)) { ERR("Submit failed: %08x\n", nsres); return E_FAIL; } return S_OK; } nsAString_Init(&action_uri_str, NULL); nsres = nsIDOMHTMLFormElement_GetFormData(This->nsform, NULL, &action_uri_str, &post_stream); if(NS_SUCCEEDED(nsres)) { const PRUnichar *action_uri; nsAString_GetData(&action_uri_str, &action_uri); hres = create_uri(action_uri, 0, &uri); }else { ERR("GetFormData failed: %08x\n", nsres); hres = E_FAIL; } nsAString_Finish(&action_uri_str); if(SUCCEEDED(hres)) { window->readystate_locked++; hres = submit_form(window, uri, post_stream); window->readystate_locked--; IUri_Release(uri); } IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(post_stream) nsIInputStream_Release(post_stream); return hres; }
static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface) { HTMLFormElement *This = impl_from_IHTMLFormElement(iface); HTMLOuterWindow *window = NULL, *this_window = NULL; nsAString action_uri_str, target_str, method_str; nsIInputStream *post_stream; BOOL is_post_submit = FALSE; IUri *uri; nsresult nsres; HRESULT hres; BOOL use_new_window = FALSE; TRACE("(%p)\n", This); if(This->element.node.doc) { HTMLDocumentNode *doc = This->element.node.doc; if(doc->window && doc->window->base.outer_window) this_window = doc->window->base.outer_window; } if(!this_window) { TRACE("No outer window\n"); return S_OK; } nsAString_Init(&target_str, NULL); nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &target_str); if(NS_SUCCEEDED(nsres)) window = get_target_window(this_window, &target_str, &use_new_window); if(!window && !use_new_window) { nsAString_Finish(&target_str); return S_OK; } nsAString_Init(&method_str, NULL); nsres = nsIDOMHTMLFormElement_GetMethod(This->nsform, &method_str); if(NS_SUCCEEDED(nsres)) { const PRUnichar *method; static const PRUnichar postW[] = {'p','o','s','t',0}; nsAString_GetData(&method_str, &method); TRACE("method is %s\n", debugstr_w(method)); is_post_submit = !strcmpiW(method, postW); } nsAString_Finish(&method_str); /* * FIXME: We currently use our submit implementation for POST submit. We should always use it. */ if(window && !is_post_submit) { nsres = nsIDOMHTMLFormElement_Submit(This->nsform); nsAString_Finish(&target_str); IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(NS_FAILED(nsres)) { ERR("Submit failed: %08x\n", nsres); return E_FAIL; } return S_OK; } nsAString_Init(&action_uri_str, NULL); nsres = nsIDOMHTMLFormElement_GetFormData(This->nsform, NULL, &action_uri_str, &post_stream); if(NS_SUCCEEDED(nsres)) { const PRUnichar *action_uri; nsAString_GetData(&action_uri_str, &action_uri); hres = create_uri(action_uri, 0, &uri); }else { ERR("GetFormData failed: %08x\n", nsres); hres = E_FAIL; } nsAString_Finish(&action_uri_str); if(SUCCEEDED(hres)) { const PRUnichar *target; nsAString_GetData(&target_str, &target); hres = submit_form(window, target, uri, post_stream); IUri_Release(uri); } nsAString_Finish(&target_str); if(window) IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(post_stream) nsIInputStream_Release(post_stream); return hres; }