mshtml: Store window URL as BSTR.

This commit is contained in:
Jacek Caban 2011-11-10 14:35:11 +01:00 committed by Alexandre Julliard
parent a100550383
commit 535e2b23a3
3 changed files with 11 additions and 8 deletions

View File

@ -308,7 +308,7 @@ struct HTMLWindow {
nsChannelBSC *bscallback;
IMoniker *mon;
LPOLESTR url;
BSTR url;
IHTMLEventObj *event;

View File

@ -1261,7 +1261,7 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result)
SAFEARRAYBOUND bound;
VARIANT var, varOut;
LONG ind;
BSTR url, unk;
BSTR unk;
HRESULT hres;
if(!This->window)
@ -1296,8 +1296,7 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result)
ind = 1;
V_VT(&var) = VT_BSTR;
url = SysAllocString(This->window->url);
V_BSTR(&var) = url;
V_BSTR(&var) = This->window->url;
SafeArrayPutElement(sa, &ind, &var);
ind = 3;
@ -1338,7 +1337,6 @@ static void handle_navigation_error(nsChannelBSC *This, DWORD result)
V_BOOL(&varOut) = VARIANT_TRUE;
IOleCommandTarget_Exec(olecmd, &CGID_DocHostCmdPriv, 1, 0, &var, FAILED(hres)?NULL:&varOut);
SysFreeString(url);
SysFreeString(unk);
SafeArrayDestroy(sa);
IOleCommandTarget_Release(olecmd);

View File

@ -68,6 +68,7 @@ static BOOL use_gecko_script(HTMLWindow *window)
void set_current_mon(HTMLWindow *This, IMoniker *mon)
{
WCHAR *url;
HRESULT hres;
if(This->mon) {
@ -76,7 +77,7 @@ void set_current_mon(HTMLWindow *This, IMoniker *mon)
}
if(This->url) {
CoTaskMemFree(This->url);
SysFreeString(This->url);
This->url = NULL;
}
@ -86,9 +87,13 @@ void set_current_mon(HTMLWindow *This, IMoniker *mon)
IMoniker_AddRef(mon);
This->mon = mon;
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &This->url);
if(FAILED(hres))
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
if(SUCCEEDED(hres)) {
This->url = SysAllocString(url);
CoTaskMemFree(url);
}else {
WARN("GetDisplayName failed: %08x\n", hres);
}
set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
}