shdocvw: Move common Navigate2 code to navigate_url.
This commit is contained in:
parent
30dd37edb0
commit
02b54914e5
|
@ -442,48 +442,18 @@ static HRESULT WINAPI InternetExplorer_Navigate2(IWebBrowser2 *iface, VARIANT *U
|
||||||
VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
|
VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
|
||||||
{
|
{
|
||||||
InternetExplorer *This = WEBBROWSER_THIS(iface);
|
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);
|
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)
|
if(!URL)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
if(V_VT(URL) != VT_BSTR)
|
if(V_VT(URL) != VT_BSTR) {
|
||||||
return E_INVALIDARG;
|
FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
|
||||||
|
|
||||||
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;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
|
return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI InternetExplorer_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
|
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)
|
LPWSTR headers)
|
||||||
{
|
{
|
||||||
IBindStatusCallback *callback;
|
IBindStatusCallback *callback;
|
||||||
|
@ -507,6 +507,47 @@ HRESULT navigate_url(DocHost *This, LPCWSTR url, PBYTE post_data, ULONG post_dat
|
||||||
return hres;
|
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,
|
HRESULT navigate_hlink(DocHost *This, IMoniker *mon, IBindCtx *bindctx,
|
||||||
IBindStatusCallback *callback)
|
IBindStatusCallback *callback)
|
||||||
{
|
{
|
||||||
|
|
|
@ -192,7 +192,7 @@ HRESULT WebBrowserV2_Create(IUnknown*,REFIID,void**);
|
||||||
void create_doc_view_hwnd(DocHost*);
|
void create_doc_view_hwnd(DocHost*);
|
||||||
void deactivate_document(DocHost*);
|
void deactivate_document(DocHost*);
|
||||||
void call_sink(ConnectionPoint*,DISPID,DISPPARAMS*);
|
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**);
|
HRESULT InternetExplorer_Create(IUnknown*,REFIID,void**);
|
||||||
void InternetExplorer_WebBrowser_Init(InternetExplorer*);
|
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)
|
VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
|
||||||
{
|
{
|
||||||
WebBrowser *This = WEBBROWSER_THIS(iface);
|
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);
|
TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
|
||||||
|
|
||||||
if(!This->client)
|
if(!This->client)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
||||||
if((Flags && V_VT(Flags) != VT_EMPTY)
|
|
||||||
|| (TargetFrameName && V_VT(TargetFrameName) != VT_EMPTY))
|
|
||||||
FIXME("Unsupported arguments\n");
|
|
||||||
|
|
||||||
|
|
||||||
if(!URL)
|
if(!URL)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
if(V_VT(URL) != VT_BSTR)
|
if(V_VT(URL) != VT_BSTR) {
|
||||||
return E_INVALIDARG;
|
FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
|
||||||
|
|
||||||
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;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
SafeArrayAccessData(V_ARRAY(PostData), (void**)&post_data);
|
return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
|
static HRESULT WINAPI WebBrowser_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
|
||||||
|
|
Loading…
Reference in New Issue