From fd47fa464750a2f59ea15e59e664ba29486dde56 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 26 Oct 2009 23:04:28 +0100 Subject: [PATCH] mshtml: Moved url and mon to HTMLWindow. --- dlls/mshtml/htmldoc.c | 3 +-- dlls/mshtml/htmllocation.c | 4 ++-- dlls/mshtml/htmlwindow.c | 1 + dlls/mshtml/mshtml_private.h | 6 +++--- dlls/mshtml/nsio.c | 2 +- dlls/mshtml/olecmd.c | 8 ++++---- dlls/mshtml/persist.c | 28 ++++++++++++++-------------- dlls/mshtml/secmgr.c | 4 ++-- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 05295f1654c..1d9c28fb9de 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -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)); diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index e7b66497922..3b91429bdb9 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -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; } diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 08f113952c1..5a53e5ad2f0 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -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); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index d7b54138344..ea6c3492a71 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -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*); diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 070d79e9f5d..01ad68546a6 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -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); diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index c2f6fef22b1..487f6cb205c 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -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}; diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 01af48712fa..f708c645c89 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -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; } diff --git a/dlls/mshtml/secmgr.c b/dlls/mshtml/secmgr.c index c71bb4b7d34..8938943fb56 100644 --- a/dlls/mshtml/secmgr.c +++ b/dlls/mshtml/secmgr.c @@ -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);