msxml3: Try mshtml container url as a base for relative request url.
This commit is contained in:
parent
fd4afaf639
commit
9b1f217c41
|
@ -33,10 +33,16 @@
|
|||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "wininet.h"
|
||||
#include "winreg.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "mshtml.h"
|
||||
#include "msxml6.h"
|
||||
#include "objsafe.h"
|
||||
#include "docobj.h"
|
||||
#include "shlwapi.h"
|
||||
|
||||
#include "msxml_private.h"
|
||||
|
||||
|
@ -72,6 +78,7 @@ typedef struct
|
|||
/* request */
|
||||
BINDVERB verb;
|
||||
BSTR custom;
|
||||
BSTR siteurl;
|
||||
BSTR url;
|
||||
BOOL async;
|
||||
struct list reqheaders;
|
||||
|
@ -767,6 +774,7 @@ static ULONG WINAPI httprequest_Release(IXMLHTTPRequest *iface)
|
|||
IUnknown_Release( This->site );
|
||||
|
||||
SysFreeString(This->custom);
|
||||
SysFreeString(This->siteurl);
|
||||
SysFreeString(This->url);
|
||||
SysFreeString(This->user);
|
||||
SysFreeString(This->password);
|
||||
|
@ -906,6 +914,21 @@ static HRESULT WINAPI httprequest_open(IXMLHTTPRequest *iface, BSTR method, BSTR
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* try to combine with site url */
|
||||
if (This->siteurl && PathIsRelativeW(url))
|
||||
{
|
||||
DWORD len = INTERNET_MAX_URL_LENGTH;
|
||||
WCHAR *fullW = heap_alloc(len*sizeof(WCHAR));
|
||||
|
||||
hr = UrlCombineW(This->siteurl, url, fullW, &len, 0);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
TRACE("combined url %s\n", debugstr_w(fullW));
|
||||
This->url = SysAllocString(fullW);
|
||||
}
|
||||
heap_free(fullW);
|
||||
}
|
||||
else
|
||||
This->url = SysAllocString(url);
|
||||
|
||||
VariantInit(&is_async);
|
||||
|
@ -1324,6 +1347,8 @@ static HRESULT WINAPI httprequest_ObjectWithSite_GetSite( IObjectWithSite *iface
|
|||
static HRESULT WINAPI httprequest_ObjectWithSite_SetSite( IObjectWithSite *iface, IUnknown *punk )
|
||||
{
|
||||
httprequest *This = impl_from_IObjectWithSite(iface);
|
||||
IServiceProvider *provider;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%p)\n", iface, punk);
|
||||
|
||||
|
@ -1335,6 +1360,23 @@ static HRESULT WINAPI httprequest_ObjectWithSite_SetSite( IObjectWithSite *iface
|
|||
|
||||
This->site = punk;
|
||||
|
||||
hr = IUnknown_QueryInterface(This->site, &IID_IServiceProvider, (void**)&provider);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
IHTMLDocument2 *doc;
|
||||
|
||||
hr = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
SysFreeString(This->siteurl);
|
||||
|
||||
hr = IHTMLDocument2_get_URL(doc, &This->siteurl);
|
||||
IHTMLDocument2_Release(doc);
|
||||
TRACE("host url %s, 0x%08x\n", debugstr_w(This->siteurl), hr);
|
||||
}
|
||||
IServiceProvider_Release(provider);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -1426,7 +1468,7 @@ HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, void **ppObj)
|
|||
req->async = FALSE;
|
||||
req->verb = -1;
|
||||
req->custom = NULL;
|
||||
req->url = req->user = req->password = NULL;
|
||||
req->url = req->siteurl = req->user = req->password = NULL;
|
||||
|
||||
req->state = READYSTATE_UNINITIALIZED;
|
||||
req->sink = NULL;
|
||||
|
|
|
@ -5000,11 +5000,11 @@ todo_wine {
|
|||
hr = IObjectWithSite_SetSite(obj_site, &testsite.IUnknown_iface);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
||||
todo_wine{
|
||||
CHECK_CALLED(site_qi_IServiceProvider);
|
||||
|
||||
todo_wine
|
||||
CHECK_CALLED(sp_queryservice_SID_SBindHost);
|
||||
CHECK_CALLED(sp_queryservice_SID_SContainerDispatch_htmldoc2);
|
||||
todo_wine {
|
||||
CHECK_CALLED(sp_queryservice_SID_secmgr_htmldoc2);
|
||||
CHECK_CALLED(sp_queryservice_SID_secmgr_xmldomdoc);
|
||||
/* this one isn't very reliable
|
||||
|
@ -5019,11 +5019,23 @@ todo_wine{
|
|||
}
|
||||
IObjectWithSite_Release(obj_site);
|
||||
|
||||
/* try to set site another time */
|
||||
|
||||
/* to be removed once IObjectWithSite is properly separated */
|
||||
SET_EXPECT(site_qi_IServiceProvider);
|
||||
SET_EXPECT(sp_queryservice_SID_SContainerDispatch_htmldoc2);
|
||||
|
||||
hr = IObjectWithSite_SetSite(obj_site2, &testsite.IUnknown_iface);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
||||
todo_wine EXPECT_REF(xhr, 1);
|
||||
IXMLHttpRequest_Release(xhr);
|
||||
|
||||
/* still works after request is released */
|
||||
|
||||
/* to be removed once IObjectWithSite is properly separated */
|
||||
SET_EXPECT(site_qi_IServiceProvider);
|
||||
SET_EXPECT(sp_queryservice_SID_SContainerDispatch_htmldoc2);
|
||||
|
||||
hr = IObjectWithSite_SetSite(obj_site2, &testsite.IUnknown_iface);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
|
|
|
@ -136,3 +136,6 @@ DEFINE_GUID(GUID_COMPARTMENT_SPEECH_GLOBALSTATE, 0x2a54fe8e,0x0d08,0x460c,0xa
|
|||
DEFINE_GUID(GUID_COMPARTMENT_PERSISTMENUENABLED, 0x575f3783,0x70c8,0x47c8,0xae,0x5d,0x91,0xa0,0x1a,0x1f,0x75,0x92);
|
||||
DEFINE_GUID(GUID_COMPARTMENT_EMPTYCONTEXT, 0xd7487dbf,0x804e,0x41c5,0x89,0x4d,0xad,0x96,0xfd,0x4e,0xea,0x13);
|
||||
DEFINE_GUID(GUID_COMPARTMENT_TIPUISTATUS, 0x148ca3ec,0x0366,0x401c,0x8d,0x75,0xed,0x97,0x8d,0x85,0xfb,0xc9);
|
||||
|
||||
/* service identifiers not declared in headers */
|
||||
DEFINE_GUID(SID_SContainerDispatch,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,0x00,0x40,0x47,0x70);
|
||||
|
|
|
@ -407,3 +407,5 @@ cpp_quote("#define IID_IMsoDocumentSite IID_IOleDocumentSite")
|
|||
cpp_quote("#define IID_IMsoView IID_IOleDocumentView")
|
||||
cpp_quote("#define IID_IEnumMsoView IID_IEnumOleDocumentViews")
|
||||
cpp_quote("#define IID_IMsoCommandTarget IID_IOleCommandTarget")
|
||||
|
||||
cpp_quote("EXTERN_C const GUID SID_SContainerDispatch;")
|
||||
|
|
Loading…
Reference in New Issue