Commit 25abcac6 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

msxml3: IXMLDOMDocument2's ::SetSite implementation should query site for base URI.

parent f9920d27
......@@ -135,6 +135,7 @@ struct domdoc
/* IObjectWithSite */
IUnknown *site;
IUri *base_uri;
/* IObjectSafety */
DWORD safeopt;
......@@ -963,6 +964,8 @@ static ULONG WINAPI domdoc_Release( IXMLDOMDocument3 *iface )
if (This->site)
IUnknown_Release( This->site );
if (This->base_uri)
IUri_Release( This->base_uri );
destroy_xmlnode(&This->node);
for (eid = 0; eid < EVENTID_LAST; eid++)
......@@ -3551,6 +3554,12 @@ static HRESULT WINAPI domdoc_ObjectWithSite_SetSite( IObjectWithSite *iface, IUn
This->site = NULL;
}
if(This->base_uri)
{
IUri_Release(This->base_uri);
This->base_uri = NULL;
}
return S_OK;
}
......@@ -3560,6 +3569,7 @@ static HRESULT WINAPI domdoc_ObjectWithSite_SetSite( IObjectWithSite *iface, IUn
IUnknown_Release( This->site );
This->site = punk;
This->base_uri = get_base_uri(This->site);
return S_OK;
}
......@@ -3664,6 +3674,7 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document)
doc->properties = properties_from_xmlDocPtr(xmldoc);
doc->error = S_OK;
doc->site = NULL;
doc->base_uri = NULL;
doc->safeopt = 0;
doc->cp_list = NULL;
doc->namespaces = NULL;
......
......@@ -1598,7 +1598,7 @@ static HRESULT WINAPI httprequest_ObjectWithSite_GetSite( IObjectWithSite *iface
return IUnknown_QueryInterface( This->site, iid, ppvSite );
}
static void get_base_uri(httprequest *This)
IUri *get_base_uri(IUnknown *site)
{
IServiceProvider *provider;
IHTMLDocument2 *doc;
......@@ -1606,30 +1606,30 @@ static void get_base_uri(httprequest *This)
BSTR url;
HRESULT hr;
hr = IUnknown_QueryInterface(This->site, &IID_IServiceProvider, (void**)&provider);
hr = IUnknown_QueryInterface(site, &IID_IServiceProvider, (void**)&provider);
if(FAILED(hr))
return;
return NULL;
hr = IServiceProvider_QueryService(provider, &SID_SContainerDispatch, &IID_IHTMLDocument2, (void**)&doc);
if(FAILED(hr))
hr = IServiceProvider_QueryService(provider, &SID_SInternetHostSecurityManager, &IID_IHTMLDocument2, (void**)&doc);
IServiceProvider_Release(provider);
if(FAILED(hr))
return;
return NULL;
hr = IHTMLDocument2_get_URL(doc, &url);
IHTMLDocument2_Release(doc);
if(FAILED(hr) || !url || !*url)
return;
return NULL;
TRACE("host url %s\n", debugstr_w(url));
hr = CreateUri(url, 0, 0, &uri);
SysFreeString(url);
if(FAILED(hr))
return;
return NULL;
This->base_uri = uri;
return uri;
}
static HRESULT WINAPI httprequest_ObjectWithSite_SetSite( IObjectWithSite *iface, IUnknown *punk )
......@@ -1648,7 +1648,7 @@ static HRESULT WINAPI httprequest_ObjectWithSite_SetSite( IObjectWithSite *iface
if (punk)
{
IUnknown_AddRef( punk );
get_base_uri(This);
This->base_uri = get_base_uri(This->site);
}
return S_OK;
......
......@@ -535,6 +535,7 @@ HRESULT create_moniker_from_url(LPCWSTR, IMoniker**) DECLSPEC_HIDDEN;
HRESULT create_uri(const WCHAR *, IUri **) DECLSPEC_HIDDEN;
HRESULT bind_url(IMoniker*, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**) DECLSPEC_HIDDEN;
HRESULT detach_bsc(bsc_t*) DECLSPEC_HIDDEN;
IUri *get_base_uri(IUnknown *) DECLSPEC_HIDDEN;
/* Error Codes - not defined anywhere in the public headers */
#define E_XML_ELEMENT_UNDECLARED 0xC00CE00D
......
......@@ -13226,17 +13226,13 @@ static void test_load_with_site(void)
qi_count = 0;
hr = IObjectWithSite_SetSite(site, (IUnknown *)&sp);
ok(hr == S_OK, "got %#x\n", hr);
todo_wine
ok(qi_count != 0, "got %d QI calls\n", qi_count);
todo_wine
ok(qi_list_contains(&IID_IXMLDOMDocument), "QI(IID_IXMLDOMDocument) was not called\n");
todo_wine
ok(qi_list_contains(&IID_IHTMLDocument2), "QI(IID_IHTMLDocument2) was not called\n");
todo_wine
ok(qi_list_contains(&IID_IServiceProvider), "QI(IID_IServiceProvider) was not called\n");
todo_wine
ok(qi_list_contains(&IID_IOleClientSite), "QI(IID_IOleClientSite) was not called\n");
todo_wine
ok(qi_list_contains_service(&SID_SContainerDispatch, &IID_IHTMLDocument2),
"QI(SID_SContainerDispatch, IID_IHTMLDocument2) was not called\n");
todo_wine
......
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