Commit 02b54914 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

shdocvw: Move common Navigate2 code to navigate_url.

parent 30dd37ed
......@@ -442,48 +442,18 @@ static HRESULT WINAPI InternetExplorer_Navigate2(IWebBrowser2 *iface, VARIANT *U
VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
{
InternetExplorer *This = WEBBROWSER_THIS(iface);
PBYTE post_data = NULL;
ULONG post_data_len = 0;
LPWSTR headers = NULL;
HRESULT hres;
TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
if((Flags && V_VT(Flags) != VT_EMPTY)
|| (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
FIXME("Unsupported arguments\n");
if(!URL)
return S_OK;
if(V_VT(URL) != VT_BSTR)
if(V_VT(URL) != VT_BSTR) {
FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
return E_INVALIDARG;
if(PostData && V_VT(PostData) != VT_EMPTY) {
if(V_VT(PostData) != (VT_ARRAY | VT_UI1)
|| V_ARRAY(PostData)->cDims != 1) {
WARN("Invalid PostData\n");
return E_INVALIDARG;
}
SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
}
if(Headers && V_VT(Headers) != VT_EMPTY) {
if(V_VT(Headers) != VT_BSTR)
return E_INVALIDARG;
headers = V_BSTR(Headers);
TRACE("Headers: %s\n", debugstr_w(headers));
}
hres = navigate_url(&This->doc_host, V_BSTR(URL), post_data, post_data_len, headers);
if(post_data)
SafeArrayUnaccessData(V_ARRAY(PostData));
return hres;
return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
}
static HRESULT WINAPI InternetExplorer_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
......
......@@ -476,7 +476,7 @@ static HRESULT navigate(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
}
HRESULT navigate_url(DocHost *This, LPCWSTR url, PBYTE post_data, ULONG post_data_len,
static HRESULT bind_url_to_object(DocHost *This, LPCWSTR url, PBYTE post_data, ULONG post_data_len,
LPWSTR headers)
{
IBindStatusCallback *callback;
......@@ -507,6 +507,47 @@ HRESULT navigate_url(DocHost *This, LPCWSTR url, PBYTE post_data, ULONG post_dat
return hres;
}
HRESULT navigate_url(DocHost *This, BSTR url, VARIANT *Flags, VARIANT *TargetFrameName,
VARIANT *PostData, VARIANT *Headers)
{
PBYTE post_data = NULL;
ULONG post_data_len = 0;
LPWSTR headers = NULL;
HRESULT hres;
TRACE("navigating to %s\n", debugstr_w(url));
if((Flags && V_VT(Flags) != VT_EMPTY)
|| (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
FIXME("Unsupported arguments\n");
if(PostData && V_VT(PostData) != VT_EMPTY && V_VT(PostData) != VT_ERROR) {
if(V_VT(PostData) != (VT_ARRAY | VT_UI1)
|| V_ARRAY(PostData)->cDims != 1) {
WARN("Invalid PostData\n");
return E_INVALIDARG;
}
SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
}
if(Headers && V_VT(Headers) != VT_EMPTY && V_VT(Headers) != VT_ERROR) {
if(V_VT(Headers) != VT_BSTR)
return E_INVALIDARG;
headers = V_BSTR(Headers);
TRACE("Headers: %s\n", debugstr_w(headers));
}
hres = bind_url_to_object(This, url, post_data, post_data_len, headers);
if(post_data)
SafeArrayUnaccessData(V_ARRAY(PostData));
return hres;
}
HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
IBindStatusCallback *callback)
{
......
......@@ -192,7 +192,7 @@ HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
void create_doc_view_hwnd(DocHost*);
void deactivate_document(DocHost*);
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
HRESULT navigate_url(DocHost*,LPCWSTR,PBYTE,ULONG,LPWSTR);
HRESULT navigate_url(DocHost*,BSTR,VARIANT*,VARIANT*,VARIANT*,VARIANT*);
HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
void InternetExplorer_WebBrowser_Init(InternetExplorer*);
......
......@@ -660,52 +660,21 @@ static HRESULT WINAPI WebBrowser_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VA
VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
{
WebBrowser *This = WEBBROWSER_THIS(iface);
PBYTE post_data = NULL;
ULONG post_data_len = 0;
LPWSTR headers = NULL;
HRESULT hres;
TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
if(!This->client)
return E_FAIL;
if((Flags && V_VT(Flags) != VT_EMPTY)
|| (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
FIXME("Unsupported arguments\n");
if(!URL)
return S_OK;
if(V_VT(URL) != VT_BSTR)
if(V_VT(URL) != VT_BSTR) {
FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
return E_INVALIDARG;
if(PostData && V_VT(PostData) != VT_EMPTY && V_VT(PostData) != VT_ERROR) {
if(V_VT(PostData) != (VT_ARRAY | VT_UI1)
|| V_ARRAY(PostData)->cDims != 1) {
WARN("Invalid PostData\n");
return E_INVALIDARG;
}
SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
post_data_len = V_ARRAY(PostData)->rgsabound[0].cElements;
}
if(Headers && V_VT(Headers) != VT_EMPTY && V_VT(Headers) != VT_ERROR) {
if(V_VT(Headers) != VT_BSTR)
return E_INVALIDARG;
headers = V_BSTR(Headers);
TRACE("Headers: %s\n", debugstr_w(headers));
}
hres = navigate_url(&This->doc_host, V_BSTR(URL), post_data, post_data_len, headers);
if(post_data)
SafeArrayUnaccessData(V_ARRAY(PostData));
return hres;
return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
}
static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment