Commit 99af1ee3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use proper window in set_moniker when invoked on frame or iframe.

parent 6457163b
......@@ -110,7 +110,7 @@ nsresult on_start_uri_open(NSContainer*,nsIURI*,cpp_bool*) DECLSPEC_HIDDEN;
HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsChannel*,DWORD,BOOL*) DECLSPEC_HIDDEN;
HRESULT create_doc_uri(HTMLOuterWindow*,IUri*,nsWineURI**) DECLSPEC_HIDDEN;
HRESULT load_nsuri(HTMLOuterWindow*,nsWineURI*,nsChannelBSC*,DWORD) DECLSPEC_HIDDEN;
HRESULT set_moniker(HTMLDocument*,IMoniker*,IUri*,IBindCtx*,nsChannelBSC*,BOOL) DECLSPEC_HIDDEN;
HRESULT set_moniker(HTMLOuterWindow*,IMoniker*,IUri*,IBindCtx*,nsChannelBSC*,BOOL) DECLSPEC_HIDDEN;
void prepare_for_binding(HTMLDocument*,IMoniker*,DWORD) DECLSPEC_HIDDEN;
HRESULT super_navigate(HTMLOuterWindow*,IUri*,DWORD,const WCHAR*,BYTE*,DWORD) DECLSPEC_HIDDEN;
HRESULT load_uri(HTMLOuterWindow*,IUri*,DWORD) DECLSPEC_HIDDEN;
......
......@@ -1132,7 +1132,7 @@ static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
WARN("OnStopRequest failed: %08x\n", nsres);
}
if(This->nschannel->load_group) {
if(This->nschannel && This->nschannel->load_group) {
nsres = nsILoadGroup_RemoveRequest(This->nschannel->load_group,
(nsIRequest*)&This->nschannel->nsIHttpChannel_iface, NULL, request_result);
if(NS_FAILED(nsres))
......@@ -1759,6 +1759,7 @@ HRESULT create_channelbsc(IMoniker *mon, const WCHAR *headers, BYTE *post_data,
ret->bsc.post_data_len = post_data_size;
}
TRACE("created %p\n", ret);
*retval = ret;
return S_OK;
}
......@@ -1954,7 +1955,7 @@ static void navigate_proc(task_t *_task)
navigate_task_t *task = (navigate_task_t*)_task;
HRESULT hres;
hres = set_moniker(&task->window->doc_obj->basedoc, task->mon, task->uri, NULL, task->bscallback, TRUE);
hres = set_moniker(task->window, task->mon, task->uri, NULL, task->bscallback, TRUE);
if(SUCCEEDED(hres)) {
set_current_mon(task->window, task->bscallback->bsc.mon, task->flags);
set_current_uri(task->window, task->uri);
......
......@@ -349,15 +349,20 @@ void prepare_for_binding(HTMLDocument *This, IMoniker *mon, DWORD flags)
}
}
HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IUri *nav_uri, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download)
HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBindCtx *pibc, nsChannelBSC *async_bsc,
BOOL set_download)
{
download_proc_task_t *download_task;
HTMLDocumentObj *doc_obj = NULL;
nsChannelBSC *bscallback;
nsWineURI *nsuri;
LPOLESTR url;
IUri *uri;
HRESULT hres;
if(window->doc_obj && window->doc_obj->basedoc.window == window)
doc_obj = window->doc_obj;
hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url);
if(FAILED(hres)) {
WARN("GetDiaplayName failed: %08x\n", hres);
......@@ -376,9 +381,9 @@ HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IUri *nav_uri, IBindCtx *
TRACE("got url: %s\n", debugstr_w(url));
set_ready_state(This->window, READYSTATE_LOADING);
set_ready_state(window, READYSTATE_LOADING);
hres = create_doc_uri(This->window, uri, &nsuri);
hres = create_doc_uri(window, uri, &nsuri);
if(!nav_uri)
IUri_Release(uri);
if(SUCCEEDED(hres)) {
......@@ -389,13 +394,16 @@ HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IUri *nav_uri, IBindCtx *
}
if(SUCCEEDED(hres)) {
remove_target_tasks(This->task_magic);
abort_window_bindings(This->window->base.inner_window);
if(window->base.inner_window->doc)
remove_target_tasks(window->base.inner_window->task_magic);
abort_window_bindings(window->base.inner_window);
hres = load_nsuri(This->window, nsuri, bscallback, LOAD_FLAGS_BYPASS_CACHE);
hres = load_nsuri(window, nsuri, bscallback, LOAD_FLAGS_BYPASS_CACHE);
nsISupports_Release((nsISupports*)nsuri); /* FIXME */
if(SUCCEEDED(hres))
hres = create_pending_window(This->window, bscallback);
if(SUCCEEDED(hres)) {
hres = create_pending_window(window, bscallback);
TRACE("pending window for %p %p %p\n", window, bscallback, window->pending_window);
}
if(bscallback != async_bsc)
IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface);
}
......@@ -405,25 +413,29 @@ HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IUri *nav_uri, IBindCtx *
return hres;
}
HTMLDocument_LockContainer(This->doc_obj, TRUE);
if(doc_obj) {
HTMLDocument_LockContainer(doc_obj, TRUE);
if(This->doc_obj->frame) {
docobj_task_t *task;
if(doc_obj->frame) {
docobj_task_t *task;
task = heap_alloc(sizeof(docobj_task_t));
task->doc = This->doc_obj;
hres = push_task(&task->header, set_progress_proc, NULL, This->doc_obj->basedoc.task_magic);
if(FAILED(hres)) {
CoTaskMemFree(url);
return hres;
task = heap_alloc(sizeof(docobj_task_t));
task->doc = doc_obj;
hres = push_task(&task->header, set_progress_proc, NULL, doc_obj->basedoc.task_magic);
if(FAILED(hres)) {
CoTaskMemFree(url);
return hres;
}
}
download_task = heap_alloc(sizeof(download_proc_task_t));
download_task->doc = doc_obj;
download_task->set_download = set_download;
download_task->url = url;
return push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, doc_obj->basedoc.task_magic);
}
download_task = heap_alloc(sizeof(download_proc_task_t));
download_task->doc = This->doc_obj;
download_task->set_download = set_download;
download_task->url = url;
return push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, This->doc_obj->basedoc.task_magic);
return S_OK;
}
void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate)
......@@ -562,7 +574,7 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
prepare_for_binding(This, pimkName, FALSE);
call_docview_84(This->doc_obj);
hres = set_moniker(This, pimkName, NULL, pibc, NULL, TRUE);
hres = set_moniker(This->window, pimkName, NULL, pibc, NULL, TRUE);
if(FAILED(hres))
return hres;
......@@ -831,7 +843,7 @@ static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM
}
prepare_for_binding(This, mon, FALSE);
hres = set_moniker(This, mon, NULL, NULL, NULL, TRUE);
hres = set_moniker(This->window, mon, NULL, NULL, NULL, TRUE);
IMoniker_Release(mon);
if(FAILED(hres))
return hres;
......@@ -888,7 +900,7 @@ static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
}
prepare_for_binding(This, mon, FALSE);
hres = set_moniker(This, mon, NULL, NULL, NULL, FALSE);
hres = set_moniker(This->window, mon, NULL, NULL, NULL, FALSE);
IMoniker_Release(mon);
if(FAILED(hres))
return hres;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment