diff --git a/dlls/mshtml/binding.h b/dlls/mshtml/binding.h index 073f2fba9e8..e40735cf441 100644 --- a/dlls/mshtml/binding.h +++ b/dlls/mshtml/binding.h @@ -138,9 +138,9 @@ HRESULT set_moniker(HTMLOuterWindow*,IMoniker*,IUri*,IBindCtx*,nsChannelBSC*,BOO void prepare_for_binding(HTMLDocument*,IMoniker*,DWORD) DECLSPEC_HIDDEN; HRESULT super_navigate(HTMLOuterWindow*,IUri*,DWORD,const WCHAR*,BYTE*,DWORD) DECLSPEC_HIDDEN; HRESULT load_uri(HTMLOuterWindow*,IUri*,DWORD) DECLSPEC_HIDDEN; -HRESULT navigate_new_window(HTMLOuterWindow*,IUri*,const WCHAR*,IHTMLWindow2**) DECLSPEC_HIDDEN; +HRESULT navigate_new_window(HTMLOuterWindow*,IUri*,const WCHAR*,request_data_t*,IHTMLWindow2**) DECLSPEC_HIDDEN; HRESULT navigate_url(HTMLOuterWindow*,const WCHAR*,IUri*,DWORD) DECLSPEC_HIDDEN; -HRESULT submit_form(HTMLOuterWindow*,IUri*,nsIInputStream*) DECLSPEC_HIDDEN; +HRESULT submit_form(HTMLOuterWindow*,const WCHAR*,IUri*,nsIInputStream*) DECLSPEC_HIDDEN; void init_bscallback(BSCallback*,const BSCallbackVtbl*,IMoniker*,DWORD) DECLSPEC_HIDDEN; HRESULT create_channelbsc(IMoniker*,const WCHAR*,BYTE*,DWORD,BOOL,nsChannelBSC**) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/hlink.c b/dlls/mshtml/hlink.c index 4e63498e15f..7ce0423922a 100644 --- a/dlls/mshtml/hlink.c +++ b/dlls/mshtml/hlink.c @@ -85,7 +85,7 @@ static HRESULT WINAPI HlinkTarget_Navigate(IHlinkTarget *iface, DWORD grfHLNF, L FIXME("JumpLocation not supported\n"); if(!This->doc_obj->client) - return navigate_new_window(This->window, This->window->uri, NULL, NULL); + return navigate_new_window(This->window, This->window->uri, NULL, NULL, NULL); return IOleObject_DoVerb(&This->IOleObject_iface, OLEIVERB_SHOW, NULL, NULL, -1, NULL, NULL); } diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index df95c2b3ce8..6650a447032 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -65,7 +65,7 @@ static HRESULT navigate_anchor_window(HTMLAnchorElement *This, const WCHAR *targ if(FAILED(hres)) return hres; - hres = navigate_new_window(This->element.node.doc->basedoc.window, uri, target, NULL); + hres = navigate_new_window(This->element.node.doc->basedoc.window, uri, target, NULL, NULL); IUri_Release(uri); return hres; } diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index e901dbe2547..2b2a62f65e5 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -389,6 +389,7 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface) IUri *uri; nsresult nsres; HRESULT hres; + BOOL use_new_window; TRACE("(%p)->()\n", This); @@ -404,22 +405,21 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface) nsAString_Init(&target_str, NULL); nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &target_str); - if(NS_SUCCEEDED(nsres)) { - BOOL use_new_window; + if(NS_SUCCEEDED(nsres)) 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) + + if(!window && !use_new_window) { + nsAString_Finish(&target_str); 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) { + if(window && (!window->doc_obj || window->doc_obj->basedoc.window != window)) { 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); @@ -442,13 +442,16 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface) } nsAString_Finish(&action_uri_str); if(SUCCEEDED(hres)) { - window->readystate_locked++; - hres = submit_form(window, uri, post_stream); - window->readystate_locked--; + const PRUnichar *target; + + nsAString_GetData(&target_str, &target); + hres = submit_form(window, target, uri, post_stream); IUri_Release(uri); } - IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); + nsAString_Finish(&target_str); + if(window) + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(post_stream) nsIInputStream_Release(post_stream); return hres; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 6c6c3289635..82bb3741f39 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -967,7 +967,7 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name, if(FAILED(hres)) return hres; - hres = navigate_new_window(window, uri, name, pomWindowResult); + hres = navigate_new_window(window, uri, name, NULL, pomWindowResult); IUri_Release(uri); return hres; } diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 85e47aa0090..2ac12eab2da 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -2107,7 +2107,7 @@ HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, DWORD flags, const WC return hres; } -HRESULT navigate_new_window(HTMLOuterWindow *window, IUri *uri, const WCHAR *name, IHTMLWindow2 **ret) +HRESULT navigate_new_window(HTMLOuterWindow *window, IUri *uri, const WCHAR *name, request_data_t *request_data, IHTMLWindow2 **ret) { IWebBrowser2 *web_browser; IHTMLWindow2 *new_window; @@ -2115,7 +2115,12 @@ HRESULT navigate_new_window(HTMLOuterWindow *window, IUri *uri, const WCHAR *nam nsChannelBSC *bsc; HRESULT hres; - hres = create_channelbsc(NULL, NULL, NULL, 0, FALSE, &bsc); + if(request_data) + hres = create_channelbsc(NULL, request_data->headers, + request_data->post_data, request_data->post_data_len, FALSE, + &bsc); + else + hres = create_channelbsc(NULL, NULL, NULL, 0, FALSE, &bsc); if(FAILED(hres)) return hres; @@ -2322,23 +2327,32 @@ static HRESULT translate_uri(HTMLOuterWindow *window, IUri *orig_uri, BSTR *ret_ return S_OK; } -HRESULT submit_form(HTMLOuterWindow *window, IUri *submit_uri, nsIInputStream *post_stream) +HRESULT submit_form(HTMLOuterWindow *window, const WCHAR *target, IUri *submit_uri, nsIInputStream *post_stream) { request_data_t request_data = {NULL}; - BSTR display_uri; - IUri *uri; HRESULT hres; hres = read_post_data_stream(post_stream, TRUE, NULL, &request_data); if(FAILED(hres)) return hres; - hres = translate_uri(window, submit_uri, &display_uri, &uri); - if(SUCCEEDED(hres)) { - hres = navigate_uri(window, uri, display_uri, &request_data, BINDING_NAVIGATED|BINDING_SUBMIT); - IUri_Release(uri); - SysFreeString(display_uri); - } + if(window) { + IUri *uri; + BSTR display_uri; + + window->readystate_locked++; + + hres = translate_uri(window, submit_uri, &display_uri, &uri); + if(SUCCEEDED(hres)) { + hres = navigate_uri(window, uri, display_uri, &request_data, BINDING_NAVIGATED|BINDING_SUBMIT); + IUri_Release(uri); + SysFreeString(display_uri); + } + + window->readystate_locked--; + }else + hres = navigate_new_window(window, submit_uri, target, &request_data, NULL); + release_request_data(&request_data); return hres; }