mshtml: Moved binding list to HTMLInnerWindow.

This commit is contained in:
Jacek Caban 2012-07-11 13:51:00 +02:00 committed by Alexandre Julliard
parent 59f7c24432
commit 94f0f884fd
8 changed files with 37 additions and 39 deletions

View File

@ -72,7 +72,7 @@ struct BSCallback {
IMoniker *mon;
IBinding *binding;
HTMLDocumentNode *doc;
HTMLInnerWindow *window;
struct list entry;
};

View File

@ -2216,7 +2216,6 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLOuterWindo
&doc->node.dispex.IDispatchEx_iface);
HTMLDocumentNode_SecMgr_Init(doc);
list_init(&doc->bindings);
list_init(&doc->selection_list);
list_init(&doc->range_list);
list_init(&doc->plugin_hosts);

View File

@ -2588,6 +2588,7 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, HTMLDocumentNo
return E_OUTOFMEMORY;
list_init(&window->script_hosts);
list_init(&window->bindings);
window->base.outer_window = outer_window;
window->base.inner_window = window;
@ -2670,7 +2671,7 @@ static HRESULT window_set_docnode(HTMLOuterWindow *window, HTMLDocumentNode *doc
if(window->doc_obj && window == window->doc_obj->basedoc.window)
window->base.inner_window->doc->basedoc.cp_container.forward_container = NULL;
detach_events(window->base.inner_window->doc);
abort_document_bindings(window->base.inner_window->doc);
abort_window_bindings(window->base.inner_window);
release_script_hosts(window->base.inner_window);
}

View File

@ -360,6 +360,8 @@ struct HTMLInnerWindow {
global_prop_t *global_props;
DWORD global_prop_cnt;
DWORD global_prop_size;
struct list bindings;
};
typedef enum {
@ -652,7 +654,6 @@ struct HTMLDocumentNode {
BOOL skip_mutation_notif;
struct list bindings;
struct list selection_list;
struct list range_list;
struct list plugin_hosts;
@ -752,13 +753,13 @@ nsIWritableVariant *create_nsvariant(void) DECLSPEC_HIDDEN;
void set_window_bscallback(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
void set_current_mon(HTMLOuterWindow*,IMoniker*) DECLSPEC_HIDDEN;
void set_current_uri(HTMLOuterWindow*,IUri*) DECLSPEC_HIDDEN;
HRESULT start_binding(HTMLOuterWindow*,HTMLDocumentNode*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
HRESULT start_binding(HTMLOuterWindow*,HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
HRESULT async_start_doc_binding(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
void abort_document_bindings(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;
HRESULT bind_mon_to_buffer(HTMLDocumentNode*,IMoniker*,void**,DWORD*) DECLSPEC_HIDDEN;
HRESULT bind_mon_to_buffer(HTMLInnerWindow*,IMoniker*,void**,DWORD*) DECLSPEC_HIDDEN;
void set_ready_state(HTMLOuterWindow*,READYSTATE) DECLSPEC_HIDDEN;

View File

@ -299,8 +299,8 @@ static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *ifa
IBinding_AddRef(pbind);
This->binding = pbind;
if(This->doc)
list_add_head(&This->doc->bindings, &This->entry);
if(This->window)
list_add_head(&This->window->bindings, &This->entry);
return This->vtbl->start_binding(This);
}
@ -349,7 +349,7 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *ifac
list_remove(&This->entry);
list_init(&This->entry);
This->doc = NULL;
This->window = NULL;
return hres;
}
@ -585,8 +585,8 @@ static HRESULT WINAPI BSCServiceProvider_QueryService(IServiceProvider *iface,
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
if(This->doc && IsEqualGUID(guidService, &IID_IWindowForBindingUI))
return IServiceProvider_QueryService(&This->doc->basedoc.IServiceProvider_iface, guidService, riid, ppv);
if(This->window && IsEqualGUID(guidService, &IID_IWindowForBindingUI))
return IServiceProvider_QueryService(&This->window->base.IServiceProvider_iface, guidService, riid, ppv);
return E_NOINTERFACE;
}
@ -717,16 +717,16 @@ static HRESULT process_response_headers(nsChannelBSC *This, const WCHAR *headers
return S_OK;
}
HRESULT start_binding(HTMLOuterWindow *window, HTMLDocumentNode *doc, BSCallback *bscallback, IBindCtx *bctx)
HRESULT start_binding(HTMLOuterWindow *window, HTMLInnerWindow *inner_window, BSCallback *bscallback, IBindCtx *bctx)
{
IStream *str = NULL;
HRESULT hres;
TRACE("(%p %p %p %p)\n", window, doc, bscallback, bctx);
TRACE("(%p %p %p %p)\n", window, inner_window, bscallback, bctx);
bscallback->doc = doc;
if(!doc && window)
bscallback->doc = window->base.inner_window->doc;
bscallback->window = inner_window;
if(!inner_window && window)
bscallback->window = window->base.inner_window;
/* NOTE: IE7 calls IsSystemMoniker here*/
@ -871,14 +871,14 @@ static BufferBSC *create_bufferbsc(IMoniker *mon)
return ret;
}
HRESULT bind_mon_to_buffer(HTMLDocumentNode *doc, IMoniker *mon, void **buf, DWORD *size)
HRESULT bind_mon_to_buffer(HTMLInnerWindow *window, IMoniker *mon, void **buf, DWORD *size)
{
BufferBSC *bsc = create_bufferbsc(mon);
HRESULT hres;
*buf = NULL;
hres = start_binding(NULL, doc, &bsc->bsc, NULL);
hres = start_binding(NULL, window, &bsc->bsc, NULL);
if(SUCCEEDED(hres)) {
hres = bsc->hres;
if(SUCCEEDED(hres)) {
@ -998,12 +998,9 @@ static HRESULT on_start_nsrequest(nsChannelBSC *This)
list_remove(&This->bsc.entry);
list_init(&This->bsc.entry);
update_window_doc(This->window);
if(This->window->base.inner_window->doc != This->bsc.doc) {
if(This->bsc.doc)
list_remove(&This->bsc.entry);
This->bsc.doc = This->window->base.inner_window->doc;
}
list_add_head(&This->bsc.doc->bindings, &This->bsc.entry);
if(This->window->base.inner_window != This->bsc.window)
This->bsc.window = This->window->base.inner_window;
list_add_head(&This->bsc.window->bindings, &This->bsc.entry);
if(This->window->readystate != READYSTATE_LOADING)
set_ready_state(This->window, READYSTATE_LOADING);
}
@ -1334,7 +1331,7 @@ static HRESULT async_stop_request(nsChannelBSC *This)
IBindStatusCallback_AddRef(&This->bsc.IBindStatusCallback_iface);
task->bsc = This;
push_task(&task->header, stop_request_proc, stop_request_task_destr, This->bsc.doc->basedoc.doc_obj->basedoc.task_magic);
push_task(&task->header, stop_request_proc, stop_request_task_destr, This->window->doc_obj->basedoc.task_magic);
return S_OK;
}
@ -1658,7 +1655,7 @@ void set_window_bscallback(HTMLOuterWindow *window, nsChannelBSC *callback)
if(window->bscallback) {
if(window->bscallback->bsc.binding)
IBinding_Abort(window->bscallback->bsc.binding);
window->bscallback->bsc.doc = NULL;
window->bscallback->bsc.window = NULL;
window->bscallback->window = NULL;
IBindStatusCallback_Release(&window->bscallback->bsc.IBindStatusCallback_iface);
}
@ -1668,7 +1665,7 @@ void set_window_bscallback(HTMLOuterWindow *window, nsChannelBSC *callback)
if(callback) {
callback->window = window;
IBindStatusCallback_AddRef(&callback->bsc.IBindStatusCallback_iface);
callback->bsc.doc = window->base.inner_window->doc;
callback->bsc.window = window->base.inner_window;
}
}
@ -1711,15 +1708,15 @@ HRESULT async_start_doc_binding(HTMLOuterWindow *window, nsChannelBSC *bscallbac
return S_OK;
}
void abort_document_bindings(HTMLDocumentNode *doc)
void abort_window_bindings(HTMLInnerWindow *window)
{
BSCallback *iter, *next;
LIST_FOR_EACH_ENTRY_SAFE(iter, next, &doc->bindings, BSCallback, entry) {
LIST_FOR_EACH_ENTRY_SAFE(iter, next, &window->bindings, BSCallback, entry) {
TRACE("Aborting %p\n", iter);
if(iter->doc)
remove_target_tasks(iter->doc->basedoc.task_magic);
if(iter->window && iter->window->doc)
remove_target_tasks(iter->window->doc->basedoc.task_magic);
if(iter->binding)
IBinding_Abort(iter->binding);
@ -1729,7 +1726,7 @@ void abort_document_bindings(HTMLDocumentNode *doc)
iter->vtbl->stop_binding(iter, E_ABORT);
}
iter->doc = NULL;
iter->window = NULL;
}
}
@ -1746,7 +1743,7 @@ HRESULT channelbsc_load_stream(nsChannelBSC *bscallback, IStream *stream)
if(!bscallback->nschannel->content_type)
return E_OUTOFMEMORY;
list_add_head(&bscallback->bsc.doc->bindings, &bscallback->bsc.entry);
list_add_head(&bscallback->bsc.window->bindings, &bscallback->bsc.entry);
if(stream)
hres = read_stream_data(bscallback, stream);
if(SUCCEEDED(hres))

View File

@ -973,7 +973,7 @@ static HTMLOuterWindow *get_channel_window(nsChannel *This)
typedef struct {
task_t header;
HTMLDocumentNode *doc;
HTMLInnerWindow *window;
nsChannelBSC *bscallback;
} start_binding_task_t;
@ -981,7 +981,7 @@ static void start_binding_proc(task_t *_task)
{
start_binding_task_t *task = (start_binding_task_t*)_task;
start_binding(NULL, task->doc, (BSCallback*)task->bscallback, NULL);
start_binding(NULL, task->window, (BSCallback*)task->bscallback, NULL);
}
static void start_binding_task_destr(task_t *_task)
@ -1022,7 +1022,7 @@ static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc
}else {
start_binding_task_t *task = heap_alloc(sizeof(start_binding_task_t));
task->doc = window->base.inner_window->doc;
task->window = window->base.inner_window;
task->bscallback = bscallback;
push_task(&task->header, start_binding_proc, start_binding_task_destr, window->base.inner_window->doc->basedoc.task_magic);
}

View File

@ -365,7 +365,7 @@ HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, nsChannel
if(SUCCEEDED(hres)) {
remove_target_tasks(This->task_magic);
abort_document_bindings(This->doc_node);
abort_window_bindings(This->window->base.inner_window);
hres = load_nsuri(This->window, nsuri, bscallback, 0/*LOAD_INITIAL_DOCUMENT_URI*/);
nsISupports_Release((nsISupports*)nsuri); /* FIXME */

View File

@ -659,7 +659,7 @@ static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
if(FAILED(hres))
return;
hres = bind_mon_to_buffer(script_host->window->base.inner_window->doc, mon, (void**)&buf, &size);
hres = bind_mon_to_buffer(script_host->window, mon, (void**)&buf, &size);
IMoniker_Release(mon);
if(FAILED(hres))
return;