From 207fe98e2acef8415114bba72aca96c378b3fe10 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 26 Oct 2009 23:03:53 +0100 Subject: [PATCH] mshtml: Moved bscallback to HTMLWindow. --- dlls/mshtml/htmldoc.c | 1 - dlls/mshtml/htmlwindow.c | 1 + dlls/mshtml/mshtml_private.h | 5 +++-- dlls/mshtml/navigate.c | 26 ++++++++++++++------------ dlls/mshtml/persist.c | 6 +++--- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 134b108cb42..05295f1654c 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1886,7 +1886,6 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface) TRACE("(%p) ref = %u\n", This, ref); if(!ref) { - set_document_bscallback(&This->basedoc, NULL); set_current_mon(&This->basedoc, NULL); if(This->basedoc.doc_node) { This->basedoc.doc_node->basedoc.doc_obj = NULL; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index d7606583cbe..08f113952c1 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -158,6 +158,7 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) if(!ref) { DWORD i; + set_window_bscallback(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 ed62cada8ff..d7b54138344 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -219,6 +219,8 @@ struct HTMLWindow { nsIDOMWindow *nswindow; HTMLWindow *parent; + nsChannelBSC *bscallback; + event_target_t *event_target; IHTMLEventObj *event; BOOL *event_vector; @@ -358,7 +360,6 @@ struct HTMLDocumentObj { DWORD update; /* FIXME: probably should be in document node object */ - nsChannelBSC *bscallback; IMoniker *mon; LPOLESTR url; struct list bindings; @@ -658,7 +659,7 @@ void init_nsevents(NSContainer*); void add_nsevent_listener(HTMLWindow*,LPCWSTR); nsresult get_nsinterface(nsISupports*,REFIID,void**); -void set_document_bscallback(HTMLDocument*,nsChannelBSC*); +void set_window_bscallback(HTMLWindow*,nsChannelBSC*); void set_current_mon(HTMLDocument*,IMoniker*); HRESULT start_binding(HTMLDocument*,BSCallback*,IBindCtx*); void detach_document_bindings(HTMLDocumentObj*); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 33bf1c1d2e8..4f0e60e1f3a 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -951,7 +951,7 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream) on_start_nsrequest(This); /* events are reset when a new document URI is loaded, so re-initialise them here */ - if(This->bsc.doc && This->bsc.doc->doc_obj->bscallback == This && This->bsc.doc->doc_obj->nscontainer) { + if(This->bsc.doc && This->bsc.doc->window->bscallback == This && This->bsc.doc->doc_obj->nscontainer) { update_window_doc(This->bsc.doc->window); init_nsevents(This->bsc.doc->doc_obj->nscontainer); } @@ -1107,27 +1107,29 @@ IMoniker *get_channelbsc_mon(nsChannelBSC *This) return This->bsc.mon; } -void set_document_bscallback(HTMLDocument *doc, nsChannelBSC *callback) +void set_window_bscallback(HTMLWindow *window, nsChannelBSC *callback) { BSCallback *iter; - if(doc->doc_obj->bscallback) { - if(doc->doc_obj->bscallback->bsc.binding) - IBinding_Abort(doc->doc_obj->bscallback->bsc.binding); - doc->doc_obj->bscallback->bsc.doc = NULL; - IBindStatusCallback_Release(STATUSCLB(&doc->doc_obj->bscallback->bsc)); + if(window->bscallback) { + if(window->bscallback->bsc.binding) + IBinding_Abort(window->bscallback->bsc.binding); + window->bscallback->bsc.doc = NULL; + IBindStatusCallback_Release(STATUSCLB(&window->bscallback->bsc)); } - LIST_FOR_EACH_ENTRY(iter, &doc->doc_obj->bindings, BSCallback, entry) { - iter->doc = NULL; - list_remove(&iter->entry); + if(window->doc_obj) { + LIST_FOR_EACH_ENTRY(iter, &window->doc_obj->bindings, BSCallback, entry) { + iter->doc = NULL; + list_remove(&iter->entry); + } } - doc->doc_obj->bscallback = callback; + window->bscallback = callback; if(callback) { IBindStatusCallback_AddRef(STATUSCLB(&callback->bsc)); - callback->bsc.doc = doc; + callback->bsc.doc = &window->doc_obj->basedoc; } } diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 36b1a348996..01af48712fa 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -196,7 +196,7 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO } } - set_document_bscallback(This, bscallback); + set_window_bscallback(This->window, bscallback); IUnknown_Release((IUnknown*)bscallback); CoTaskMemFree(url); @@ -292,7 +292,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva return hres; if(!bind_complete) - return start_binding(This, (BSCallback*)This->doc_obj->bscallback, pibc); + return start_binding(This, (BSCallback*)This->window->bscallback, pibc); return S_OK; } @@ -556,7 +556,7 @@ static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM if(FAILED(hres)) return hres; - return channelbsc_load_stream(This->doc_obj->bscallback, pStm); + return channelbsc_load_stream(This->window->bscallback, pStm); } static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStm,