diff --git a/dlls/mshtml/conpoint.c b/dlls/mshtml/conpoint.c
index df6c5cf2bcc..ca45524c33f 100644
--- a/dlls/mshtml/conpoint.c
+++ b/dlls/mshtml/conpoint.c
@@ -266,7 +266,7 @@ static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPo
TRACE("(%p)->(%s %p)\n", This, debugstr_cp_guid(riid), ppCP);
if(This->forward_container)
- return IConnectionPointContainer_FindConnectionPoint(&This->IConnectionPointContainer_iface,
+ return IConnectionPointContainer_FindConnectionPoint(&This->forward_container->IConnectionPointContainer_iface,
riid, ppCP);
*ppCP = NULL;
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index d0d378f5ec2..a4fa1be09b0 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -40,6 +40,8 @@ static struct list window_list = LIST_INIT(window_list);
static void window_set_docnode(HTMLWindow *window, HTMLDocumentNode *doc_node)
{
if(window->doc) {
+ if(window->doc_obj && window == window->doc_obj->basedoc.window)
+ window->doc->basedoc.cp_container.forward_container = NULL;
abort_document_bindings(window->doc);
window->doc->basedoc.window = NULL;
htmldoc_release(&window->doc->basedoc);
@@ -2245,6 +2247,7 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML
list_init(&window->script_hosts);
window->task_magic = get_task_target_magic();
+ *ret = window;
update_window_doc(window);
list_init(&window->children);
@@ -2257,7 +2260,6 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML
list_add_tail(&parent->children, &window->sibling_entry);
}
- *ret = window;
return S_OK;
}
diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c
index b1d14238b61..bdb8460d569 100644
--- a/dlls/mshtml/tests/events.c
+++ b/dlls/mshtml/tests/events.c
@@ -2407,7 +2407,7 @@ static void test_empty_document(void)
cp = get_cp((IUnknown*)doc, &IID_IDispatch);
hres = IConnectionPoint_Unadvise(cp, cookie);
IConnectionPoint_Release(cp);
- todo_wine ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
+ ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
IHTMLDocument2_Release(windows_doc);
}