From ccd339994766a01022abd5e2125e78918fc47175 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sun, 24 Sep 2006 23:39:55 +0200 Subject: [PATCH] mshtml: Store BSCallback in HTMDocument. --- dlls/mshtml/htmldoc.c | 2 ++ dlls/mshtml/mshtml_private.h | 7 ++++++- dlls/mshtml/navigate.c | 22 ++++++++++++++++++++-- dlls/mshtml/nsio.c | 2 +- dlls/mshtml/persist.c | 5 ++++- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 52c2c20c08c..5ba16321386 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -152,6 +152,8 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface) if(This->ipsite) IOleDocumentView_SetInPlaceSite(DOCVIEW(This), NULL); + set_document_bscallback(This, NULL); + if(This->tooltips_hwnd) DestroyWindow(This->tooltips_hwnd); if(This->hwnd) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 6af2a8cdfe1..b71277b804d 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -86,6 +86,8 @@ struct HTMLDocument { IOleInPlaceSite *ipsite; IOleInPlaceFrame *frame; + BSCallback *bscallback; + HWND hwnd; HWND tooltips_hwnd; @@ -176,6 +178,8 @@ struct BSCallback { IMoniker *mon; IBinding *binding; + HTMLDocument *doc; + nsProtocolStream *nsstream; }; @@ -314,8 +318,9 @@ void nsAString_Finish(nsAString*); nsIInputStream *create_nsstream(const char*,PRInt32); nsICommandParams *create_nscommand_params(void); -BSCallback *create_bscallback(HTMLDocument*,IMoniker*); +BSCallback *create_bscallback(IMoniker*); HRESULT start_binding(BSCallback*); +void set_document_bscallback(HTMLDocument*,BSCallback*); IHlink *Hlink_Create(void); IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection*); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 15b38b628f5..9bb1c315cf6 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -586,7 +586,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = { BSCServiceProvider_QueryService }; -BSCallback *create_bscallback(HTMLDocument *doc, IMoniker *mon) +BSCallback *create_bscallback(IMoniker *mon) { BSCallback *ret = mshtml_alloc(sizeof(BSCallback)); @@ -604,6 +604,7 @@ BSCallback *create_bscallback(HTMLDocument *doc, IMoniker *mon) ret->nscontext = NULL; ret->nsstream = NULL; ret->binding = NULL; + ret->doc = NULL; if(mon) IMoniker_AddRef(mon); @@ -690,7 +691,7 @@ void hlink_frame_navigate(HTMLDocument *doc, IHlinkFrame *hlink_frame, IMoniker *mon; IHlink *hlink; - callback = create_bscallback(doc, NULL); + callback = create_bscallback(NULL); if(post_data_stream) { parse_post_data(post_data_stream, &callback->headers, &callback->post_data, @@ -745,3 +746,20 @@ HRESULT start_binding(BSCallback *bscallback) bscallback->mon = NULL; return S_OK; } + +void set_document_bscallback(HTMLDocument *doc, BSCallback *callback) +{ + if(doc->bscallback) { + if(doc->bscallback->binding) + IBinding_Abort(doc->bscallback->binding); + doc->bscallback->doc = NULL; + IBindStatusCallback_Release(STATUSCLB(doc->bscallback)); + } + + doc->bscallback = callback; + + if(callback) { + IBindStatusCallback_AddRef(STATUSCLB(callback)); + callback->doc = doc; + } +} diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index d643e354a09..24a70b5ad3c 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -668,7 +668,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen return NS_ERROR_UNEXPECTED; } - bscallback = create_bscallback(NULL, mon); + bscallback = create_bscallback(mon); IMoniker_Release(mon); nsIChannel_AddRef(NSCHANNEL(This)); diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index c9baf7c8a63..f2347a037c5 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -218,7 +218,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva } } - bscallback = create_bscallback(This, pimkName); + bscallback = create_bscallback(pimkName); task = mshtml_alloc(sizeof(task_t)); @@ -260,6 +260,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva if(pibc) FIXME("not supported pibc\n"); + set_document_bscallback(This, bscallback); hres = start_binding(bscallback); IBindStatusCallback_Release(STATUSCLB(bscallback)); @@ -508,4 +509,6 @@ void HTMLDocument_Persist_Init(HTMLDocument *This) This->lpPersistFileVtbl = &PersistFileVtbl; This->lpMonikerPropVtbl = &MonikerPropVtbl; This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl; + + This->bscallback = NULL; }