Commit fd47fa46 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved url and mon to HTMLWindow.

parent 207fe98e
......@@ -589,7 +589,7 @@ static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
TRACE("(%p)->(%p)\n", iface, p);
*p = SysAllocString(This->doc_obj->url ? This->doc_obj->url : about_blank_url);
*p = SysAllocString(This->window->url ? This->window->url : about_blank_url);
return *p ? S_OK : E_OUTOFMEMORY;
}
......@@ -1886,7 +1886,6 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
TRACE("(%p) ref = %u\n", This, ref);
if(!ref) {
set_current_mon(&This->basedoc, NULL);
if(This->basedoc.doc_node) {
This->basedoc.doc_node->basedoc.doc_obj = NULL;
IHTMLDocument2_Release(HTMLDOC(&This->basedoc.doc_node->basedoc));
......
......@@ -37,12 +37,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static HRESULT get_url(HTMLLocation *This, const WCHAR **ret)
{
if(!This->window || !This->window->doc_obj || !This->window->doc_obj->url) {
if(!This->window || !This->window->url) {
FIXME("No current URL\n");
return E_NOTIMPL;
}
*ret = This->window->doc_obj->url;
*ret = This->window->url;
return S_OK;
}
......
......@@ -159,6 +159,7 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
DWORD i;
set_window_bscallback(This, NULL);
set_current_mon(This, NULL);
window_set_docnode(This, NULL);
release_children(This);
......
......@@ -220,6 +220,8 @@ struct HTMLWindow {
HTMLWindow *parent;
nsChannelBSC *bscallback;
IMoniker *mon;
LPOLESTR url;
event_target_t *event_target;
IHTMLEventObj *event;
......@@ -360,8 +362,6 @@ struct HTMLDocumentObj {
DWORD update;
/* FIXME: probably should be in document node object */
IMoniker *mon;
LPOLESTR url;
struct list bindings;
};
......@@ -660,7 +660,7 @@ void add_nsevent_listener(HTMLWindow*,LPCWSTR);
nsresult get_nsinterface(nsISupports*,REFIID,void**);
void set_window_bscallback(HTMLWindow*,nsChannelBSC*);
void set_current_mon(HTMLDocument*,IMoniker*);
void set_current_mon(HTMLWindow*,IMoniker*);
HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*);
void detach_document_bindings(HTMLDocumentObj*);
......
......@@ -737,7 +737,7 @@ static nsresult async_open(nsChannel *This, HTMLWindow *window, BOOL is_doc_chan
return NS_ERROR_UNEXPECTED;
if(is_doc_channel)
set_current_mon(&window->doc_obj->basedoc, mon);
set_current_mon(window, mon);
bscallback = create_channelbsc(mon);
IMoniker_Release(mon);
......
......@@ -543,9 +543,9 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
This->doc_obj->usermode = EDITMODE;
if(This->doc_obj->mon) {
if(This->window->mon) {
CLSID clsid = IID_NULL;
hres = IMoniker_GetClassID(This->doc_obj->mon, &clsid);
hres = IMoniker_GetClassID(This->window->mon, &clsid);
if(SUCCEEDED(hres)) {
/* We should use IMoniker::Save here */
FIXME("Use CLSID %s\n", debugstr_guid(&clsid));
......@@ -588,11 +588,11 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
update_doc(This, UPDATE_UI);
if(This->doc_obj->mon) {
if(This->window->mon) {
/* FIXME: We should find nicer way to do this */
remove_doc_tasks(This);
mon = This->doc_obj->mon;
mon = This->window->mon;
IMoniker_AddRef(mon);
}else {
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
......
......@@ -48,31 +48,31 @@ static BOOL use_gecko_script(LPCWSTR url)
&& strncmpiW(aboutW, url, sizeof(aboutW)/sizeof(WCHAR));
}
void set_current_mon(HTMLDocument *This, IMoniker *mon)
void set_current_mon(HTMLWindow *This, IMoniker *mon)
{
HRESULT hres;
if(This->doc_obj->mon) {
IMoniker_Release(This->doc_obj->mon);
This->doc_obj->mon = NULL;
if(This->mon) {
IMoniker_Release(This->mon);
This->mon = NULL;
}
if(This->doc_obj->url) {
CoTaskMemFree(This->doc_obj->url);
This->doc_obj->url = NULL;
if(This->url) {
CoTaskMemFree(This->url);
This->url = NULL;
}
if(!mon)
return;
IMoniker_AddRef(mon);
This->doc_obj->mon = mon;
This->mon = mon;
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &This->doc_obj->url);
hres = IMoniker_GetDisplayName(mon, NULL, NULL, &This->url);
if(FAILED(hres))
WARN("GetDisplayName failed: %08x\n", hres);
set_script_mode(This->window, use_gecko_script(This->doc_obj->url) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
set_script_mode(This, use_gecko_script(This->url) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT);
}
static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BOOL *bind_complete)
......@@ -127,7 +127,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
TRACE("got url: %s\n", debugstr_w(url));
set_current_mon(This, mon);
set_current_mon(This->window, mon);
if(This->doc_obj->client) {
VARIANT silent, offline;
......@@ -318,11 +318,11 @@ static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoni
TRACE("(%p)->(%p)\n", This, ppimkName);
if(!This->doc_obj->mon)
if(!This->window || !This->window->mon)
return E_UNEXPECTED;
IMoniker_AddRef(This->doc_obj->mon);
*ppimkName = This->doc_obj->mon;
IMoniker_AddRef(This->window->mon);
*ppimkName = This->window->mon;
return S_OK;
}
......
......@@ -78,7 +78,7 @@ static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHost
TRACE("(%p)->(%d %p %d %p %d %x %x)\n", This, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved);
url = This->basedoc.doc_obj->url ? This->basedoc.doc_obj->url : about_blankW;
url = This->basedoc.window->url ? This->basedoc.window->url : about_blankW;
return IInternetSecurityManager_ProcessUrlAction(This->secmgr, url, dwAction, pPolicy, cbPolicy,
pContext, cbContext, dwFlags, dwReserved);
......@@ -124,7 +124,7 @@ static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHos
TRACE("(%p)->(%s %p %p %p %d %x)\n", This, debugstr_guid(guidKey), ppPolicy, pcbPolicy, pContext, cbContext, dwReserved);
url = This->basedoc.doc_obj->url ? This->basedoc.doc_obj->url : about_blankW;
url = This->basedoc.window->url ? This->basedoc.window->url : about_blankW;
hres = IInternetSecurityManager_QueryCustomPolicy(This->secmgr, url, guidKey, ppPolicy, pcbPolicy,
pContext, cbContext, dwReserved);
......
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