diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7dd54bd52f..9668fcde93 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -388,6 +388,7 @@ extern const cmdtable_t editmode_cmds[]; #define UPDATE_TITLE 0x0002 void update_doc(HTMLDocument *This, DWORD flags); +void update_title(HTMLDocument*); /* editor */ void set_ns_editmode(NSContainer*); diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 8045241484..cb1025bad9 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -153,6 +153,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO This->readystate = READYSTATE_LOADING; call_property_onchanged(This->cp_propnotif, DISPID_READYSTATE); + update_doc(This, UPDATE_TITLE); HTMLDocument_LockContainer(This, TRUE); diff --git a/dlls/mshtml/task.c b/dlls/mshtml/task.c index 8949cdf69e..057f22706f 100644 --- a/dlls/mshtml/task.c +++ b/dlls/mshtml/task.c @@ -155,6 +155,8 @@ static void set_parsecomplete(HTMLDocument *doc) IOleCommandTarget_Exec(olecmd, &CGID_MSHTML, IDM_PARSECOMPLETE, 0, NULL, NULL); IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_HTTPEQUIV_DONE, 0, NULL, NULL); + + IOleCommandTarget_Release(olecmd); } doc->readystate = READYSTATE_COMPLETE; @@ -165,18 +167,7 @@ static void set_parsecomplete(HTMLDocument *doc) IOleInPlaceFrame_SetStatusText(doc->frame, wszDone); } - if(olecmd) { - VARIANT title; - WCHAR empty[] = {0}; - - V_VT(&title) = VT_BSTR; - V_BSTR(&title) = SysAllocString(empty); - IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER, - &title, NULL); - SysFreeString(V_BSTR(&title)); - - IOleCommandTarget_Release(olecmd); - } + update_title(doc); } static void set_progress(HTMLDocument *doc) diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index 238ed09bcb..4c7cea9a78 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -104,6 +104,34 @@ void update_doc(HTMLDocument *This, DWORD flags) This->update |= flags; } +void update_title(HTMLDocument *This) +{ + IOleCommandTarget *olecmd; + HRESULT hres; + + if(!(This->update & UPDATE_TITLE)) + return; + + This->update &= ~UPDATE_TITLE; + + if(!This->client) + return; + + hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd); + if(SUCCEEDED(hres)) { + VARIANT title; + WCHAR empty[] = {0}; + + V_VT(&title) = VT_BSTR; + V_BSTR(&title) = SysAllocString(empty); + IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER, + &title, NULL); + SysFreeString(V_BSTR(&title)); + + IOleCommandTarget_Release(olecmd); + } +} + static LRESULT on_timer(HTMLDocument *This) { TRACE("(%p) %x\n", This, This->update); @@ -131,6 +159,7 @@ static LRESULT on_timer(HTMLDocument *This) } } + update_title(This); This->update = 0; return 0; }