ieframe: Restore closed IOleClientSite in DoVerb.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b555f41020
commit
17379dcd08
|
@ -190,6 +190,7 @@ struct WebBrowser {
|
||||||
INT version;
|
INT version;
|
||||||
|
|
||||||
IOleClientSite *client;
|
IOleClientSite *client;
|
||||||
|
IOleClientSite *client_closed;
|
||||||
IOleContainer *container;
|
IOleContainer *container;
|
||||||
IOleInPlaceSiteEx *inplace;
|
IOleInPlaceSiteEx *inplace;
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,11 @@ static void release_client_site(WebBrowser *This)
|
||||||
This->client = NULL;
|
This->client = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(This->client_closed) {
|
||||||
|
IOleClientSite_Release(This->client_closed);
|
||||||
|
This->client_closed = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if(This->shell_embedding_hwnd) {
|
if(This->shell_embedding_hwnd) {
|
||||||
DestroyWindow(This->shell_embedding_hwnd);
|
DestroyWindow(This->shell_embedding_hwnd);
|
||||||
This->shell_embedding_hwnd = NULL;
|
This->shell_embedding_hwnd = NULL;
|
||||||
|
@ -460,6 +465,11 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, LPOLECLIENTSITE
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", This, pClientSite);
|
TRACE("(%p)->(%p)\n", This, pClientSite);
|
||||||
|
|
||||||
|
if(This->client_closed) {
|
||||||
|
IOleClientSite_Release(This->client_closed);
|
||||||
|
This->client_closed = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if(This->client == pClientSite)
|
if(This->client == pClientSite)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
@ -549,6 +559,8 @@ static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szCont
|
||||||
static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
|
static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
|
||||||
{
|
{
|
||||||
WebBrowser *This = impl_from_IOleObject(iface);
|
WebBrowser *This = impl_from_IOleObject(iface);
|
||||||
|
IOleClientSite *client;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("(%p)->(%d)\n", This, dwSaveOption);
|
TRACE("(%p)->(%d)\n", This, dwSaveOption);
|
||||||
|
|
||||||
|
@ -569,7 +581,13 @@ static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
|
||||||
if(This->inplace)
|
if(This->inplace)
|
||||||
IOleInPlaceSiteEx_OnInPlaceDeactivate(This->inplace);
|
IOleInPlaceSiteEx_OnInPlaceDeactivate(This->inplace);
|
||||||
|
|
||||||
return IOleObject_SetClientSite(iface, NULL);
|
/* store old client site - we need to restore it in DoVerb */
|
||||||
|
client = This->client;
|
||||||
|
if(This->client)
|
||||||
|
IOleClientSite_AddRef(This->client);
|
||||||
|
hres = IOleObject_SetClientSite(iface, NULL);
|
||||||
|
This->client_closed = client;
|
||||||
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)
|
static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker* pmk)
|
||||||
|
@ -611,6 +629,14 @@ static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, struct tag
|
||||||
TRACE("(%p)->(%d %p %p %d %p %s)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
|
TRACE("(%p)->(%d %p %p %d %p %s)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent,
|
||||||
wine_dbgstr_rect(lprcPosRect));
|
wine_dbgstr_rect(lprcPosRect));
|
||||||
|
|
||||||
|
/* restore closed client site if we have one */
|
||||||
|
if(!This->client && This->client_closed) {
|
||||||
|
IOleClientSite *client = This->client_closed;
|
||||||
|
This->client_closed = NULL;
|
||||||
|
IOleObject_SetClientSite(iface, client);
|
||||||
|
IOleClientSite_Release(client);
|
||||||
|
}
|
||||||
|
|
||||||
switch (iVerb)
|
switch (iVerb)
|
||||||
{
|
{
|
||||||
case OLEIVERB_SHOW:
|
case OLEIVERB_SHOW:
|
||||||
|
|
|
@ -51,7 +51,7 @@ DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
|
||||||
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
|
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
|
||||||
|
|
||||||
#define SET_EXPECT(func) \
|
#define SET_EXPECT(func) \
|
||||||
expect_ ## func = TRUE
|
do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
|
||||||
|
|
||||||
#define CHECK_EXPECT2(func) \
|
#define CHECK_EXPECT2(func) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -71,6 +71,12 @@ DEFINE_OLEGUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0);
|
||||||
expect_ ## func = called_ ## func = FALSE; \
|
expect_ ## func = called_ ## func = FALSE; \
|
||||||
}while(0)
|
}while(0)
|
||||||
|
|
||||||
|
#define CHECK_NOT_CALLED(func) \
|
||||||
|
do { \
|
||||||
|
ok(!called_ ## func, "unexpected " #func "\n"); \
|
||||||
|
expect_ ## func = called_ ## func = FALSE; \
|
||||||
|
}while(0)
|
||||||
|
|
||||||
#define CLEAR_CALLED(func) \
|
#define CLEAR_CALLED(func) \
|
||||||
expect_ ## func = called_ ## func = FALSE
|
expect_ ## func = called_ ## func = FALSE
|
||||||
|
|
||||||
|
@ -3633,19 +3639,25 @@ static void test_Close(IWebBrowser2 *wb, BOOL do_download)
|
||||||
hres = IOleObject_DoVerb(oo, OLEIVERB_HIDE, NULL, (IOleClientSite*)0xdeadbeef,
|
hres = IOleObject_DoVerb(oo, OLEIVERB_HIDE, NULL, (IOleClientSite*)0xdeadbeef,
|
||||||
0, (HWND)0xdeadbeef, NULL);
|
0, (HWND)0xdeadbeef, NULL);
|
||||||
ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
|
ok(hres == S_OK, "DoVerb failed: %08x\n", hres);
|
||||||
todo_wine CHECK_CALLED(GetContainer);
|
CHECK_CALLED(GetContainer);
|
||||||
todo_wine CHECK_CALLED(Site_GetWindow);
|
CHECK_CALLED(Site_GetWindow);
|
||||||
todo_wine CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
|
CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
|
||||||
todo_wine CHECK_CALLED(Invoke_AMBIENT_SILENT);
|
CHECK_CALLED(Invoke_AMBIENT_SILENT);
|
||||||
|
|
||||||
hres = IOleObject_GetClientSite(oo, &ocs);
|
hres = IOleObject_GetClientSite(oo, &ocs);
|
||||||
ok(hres == S_OK, "hres = %x\n", hres);
|
ok(hres == S_OK, "hres = %x\n", hres);
|
||||||
todo_wine ok(ocs == &ClientSite, "ocs != &ClientSite\n");
|
ok(ocs == &ClientSite, "ocs != &ClientSite\n");
|
||||||
if(ocs)
|
if(ocs)
|
||||||
IOleClientSite_Release(ocs);
|
IOleClientSite_Release(ocs);
|
||||||
|
|
||||||
|
SET_EXPECT(OnFocus_FALSE);
|
||||||
|
SET_EXPECT(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_FALSE);
|
||||||
|
SET_EXPECT(Invoke_COMMANDSTATECHANGE_NAVIGATEFORWARD_FALSE);
|
||||||
hres = IOleObject_Close(oo, OLECLOSE_NOSAVE);
|
hres = IOleObject_Close(oo, OLECLOSE_NOSAVE);
|
||||||
ok(hres == S_OK, "OleObject_Close failed: %x\n", hres);
|
ok(hres == S_OK, "OleObject_Close failed: %x\n", hres);
|
||||||
|
todo_wine CHECK_NOT_CALLED(OnFocus_FALSE);
|
||||||
|
todo_wine CHECK_NOT_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEBACK_FALSE);
|
||||||
|
todo_wine CHECK_NOT_CALLED(Invoke_COMMANDSTATECHANGE_NAVIGATEFORWARD_FALSE);
|
||||||
|
|
||||||
test_close = FALSE;
|
test_close = FALSE;
|
||||||
IOleObject_Release(oo);
|
IOleObject_Release(oo);
|
||||||
|
|
Loading…
Reference in New Issue