mshtml: Store BSCallback in HTMDocument.

This commit is contained in:
Jacek Caban 2006-09-24 23:39:55 +02:00 committed by Alexandre Julliard
parent 7f107fb8da
commit ccd3399947
5 changed files with 33 additions and 5 deletions

View File

@ -152,6 +152,8 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
if(This->ipsite) if(This->ipsite)
IOleDocumentView_SetInPlaceSite(DOCVIEW(This), NULL); IOleDocumentView_SetInPlaceSite(DOCVIEW(This), NULL);
set_document_bscallback(This, NULL);
if(This->tooltips_hwnd) if(This->tooltips_hwnd)
DestroyWindow(This->tooltips_hwnd); DestroyWindow(This->tooltips_hwnd);
if(This->hwnd) if(This->hwnd)

View File

@ -86,6 +86,8 @@ struct HTMLDocument {
IOleInPlaceSite *ipsite; IOleInPlaceSite *ipsite;
IOleInPlaceFrame *frame; IOleInPlaceFrame *frame;
BSCallback *bscallback;
HWND hwnd; HWND hwnd;
HWND tooltips_hwnd; HWND tooltips_hwnd;
@ -176,6 +178,8 @@ struct BSCallback {
IMoniker *mon; IMoniker *mon;
IBinding *binding; IBinding *binding;
HTMLDocument *doc;
nsProtocolStream *nsstream; nsProtocolStream *nsstream;
}; };
@ -314,8 +318,9 @@ void nsAString_Finish(nsAString*);
nsIInputStream *create_nsstream(const char*,PRInt32); nsIInputStream *create_nsstream(const char*,PRInt32);
nsICommandParams *create_nscommand_params(void); nsICommandParams *create_nscommand_params(void);
BSCallback *create_bscallback(HTMLDocument*,IMoniker*); BSCallback *create_bscallback(IMoniker*);
HRESULT start_binding(BSCallback*); HRESULT start_binding(BSCallback*);
void set_document_bscallback(HTMLDocument*,BSCallback*);
IHlink *Hlink_Create(void); IHlink *Hlink_Create(void);
IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection*); IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection*);

View File

@ -586,7 +586,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
BSCServiceProvider_QueryService BSCServiceProvider_QueryService
}; };
BSCallback *create_bscallback(HTMLDocument *doc, IMoniker *mon) BSCallback *create_bscallback(IMoniker *mon)
{ {
BSCallback *ret = mshtml_alloc(sizeof(BSCallback)); BSCallback *ret = mshtml_alloc(sizeof(BSCallback));
@ -604,6 +604,7 @@ BSCallback *create_bscallback(HTMLDocument *doc, IMoniker *mon)
ret->nscontext = NULL; ret->nscontext = NULL;
ret->nsstream = NULL; ret->nsstream = NULL;
ret->binding = NULL; ret->binding = NULL;
ret->doc = NULL;
if(mon) if(mon)
IMoniker_AddRef(mon); IMoniker_AddRef(mon);
@ -690,7 +691,7 @@ void hlink_frame_navigate(HTMLDocument *doc, IHlinkFrame *hlink_frame,
IMoniker *mon; IMoniker *mon;
IHlink *hlink; IHlink *hlink;
callback = create_bscallback(doc, NULL); callback = create_bscallback(NULL);
if(post_data_stream) { if(post_data_stream) {
parse_post_data(post_data_stream, &callback->headers, &callback->post_data, parse_post_data(post_data_stream, &callback->headers, &callback->post_data,
@ -745,3 +746,20 @@ HRESULT start_binding(BSCallback *bscallback)
bscallback->mon = NULL; bscallback->mon = NULL;
return S_OK; 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;
}
}

View File

@ -668,7 +668,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
} }
bscallback = create_bscallback(NULL, mon); bscallback = create_bscallback(mon);
IMoniker_Release(mon); IMoniker_Release(mon);
nsIChannel_AddRef(NSCHANNEL(This)); nsIChannel_AddRef(NSCHANNEL(This));

View File

@ -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)); task = mshtml_alloc(sizeof(task_t));
@ -260,6 +260,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
if(pibc) if(pibc)
FIXME("not supported pibc\n"); FIXME("not supported pibc\n");
set_document_bscallback(This, bscallback);
hres = start_binding(bscallback); hres = start_binding(bscallback);
IBindStatusCallback_Release(STATUSCLB(bscallback)); IBindStatusCallback_Release(STATUSCLB(bscallback));
@ -508,4 +509,6 @@ void HTMLDocument_Persist_Init(HTMLDocument *This)
This->lpPersistFileVtbl = &PersistFileVtbl; This->lpPersistFileVtbl = &PersistFileVtbl;
This->lpMonikerPropVtbl = &MonikerPropVtbl; This->lpMonikerPropVtbl = &MonikerPropVtbl;
This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl; This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl;
This->bscallback = NULL;
} }