mshtml: Store embedder's IOleComandTarget iface in HTMLDocumentObj and use it in handle_navigation_error.

This commit is contained in:
Jacek Caban 2012-11-12 12:58:27 +01:00 committed by Alexandre Julliard
parent 0d1ce5a308
commit f0b7db4df8
3 changed files with 11 additions and 10 deletions

View file

@ -531,6 +531,7 @@ struct HTMLDocumentObj {
IOleClientSite *client;
IDocHostUIHandler *hostui;
IOleCommandTarget *client_cmdtrg;
BOOL custom_hostui;
IOleInPlaceSite *ipsite;
IOleInPlaceFrame *frame;

View file

@ -1450,7 +1450,6 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result)
{
HTMLOuterWindow *outer_window;
HTMLDocumentObj *doc;
IOleCommandTarget *olecmd;
BOOL is_error_url;
SAFEARRAY *sa;
SAFEARRAYBOUND bound;
@ -1473,18 +1472,15 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result)
if(FAILED(hres) || is_error_url)
return;
hres = IOleClientSite_QueryInterface(doc->client,
&IID_IOleCommandTarget, (void**)&olecmd);
if(!doc->client_cmdtrg)
if(FAILED(hres))
return;
bound.lLbound = 0;
bound.cElements = 8;
sa = SafeArrayCreate(VT_VARIANT, 1, &bound);
if(!sa) {
IOleCommandTarget_Release(olecmd);
if(!sa)
return;
}
ind = 0;
V_VT(&var) = VT_I4;
@ -1532,11 +1528,10 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result)
V_ARRAY(&var) = sa;
V_VT(&varOut) = VT_BOOL;
V_BOOL(&varOut) = VARIANT_TRUE;
IOleCommandTarget_Exec(olecmd, &CGID_DocHostCmdPriv, 1, 0, &var, FAILED(hres)?NULL:&varOut);
IOleCommandTarget_Exec(doc->client_cmdtrg, &CGID_DocHostCmdPriv, 1, 0, &var, FAILED(hres)?NULL:&varOut);
SysFreeString(unk);
SafeArrayDestroy(sa);
IOleCommandTarget_Release(olecmd);
}
static HRESULT nsChannelBSC_stop_binding(BSCallback *bsc, HRESULT result)

View file

@ -231,6 +231,11 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
This->doc_obj->usermode = UNKNOWN_USERMODE;
}
if(This->doc_obj->client_cmdtrg) {
IOleCommandTarget_Release(This->doc_obj->client_cmdtrg);
This->doc_obj->client_cmdtrg = NULL;
}
if(This->doc_obj->hostui && !This->doc_obj->custom_hostui) {
IDocHostUIHandler_Release(This->doc_obj->hostui);
This->doc_obj->hostui = NULL;
@ -319,6 +324,8 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
VARIANT var;
OLECMD cmd = {OLECMDID_SETPROGRESSTEXT, 0};
This->doc_obj->client_cmdtrg = cmdtrg;
if(!hostui_setup) {
IDocObjectService *doc_object_service;
IBrowserService *browser_service;
@ -361,8 +368,6 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
IOleCommandTarget_Release(cmdtrg);
}
if(This->doc_obj->usermode == UNKNOWN_USERMODE)