Commit 535e2b23 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Store window URL as BSTR.

parent a1005503
......@@ -308,7 +308,7 @@ struct HTMLWindow {
nsChannelBSC *bscallback;
IMoniker *mon;
LPOLESTR url;
BSTR url;
IHTMLEventObj *event;
......
......@@ -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);
......
......@@ -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);
}
......
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