Commit a3037ec2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Create top content window in init_browser.

parent a007de52
......@@ -5443,9 +5443,7 @@ static dispex_static_data_t HTMLDocumentObj_dispex = {
static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID riid, void **ppv)
{
mozIDOMWindowProxy *mozwindow;
HTMLDocumentObj *doc;
nsresult nsres;
HRESULT hres;
if(outer && !IsEqualGUID(&IID_IUnknown, riid)) {
......@@ -5492,15 +5490,10 @@ static HRESULT create_document_object(BOOL is_mhtml, IUnknown *outer, REFIID rii
return hres;
}
nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &mozwindow);
if(NS_FAILED(nsres))
ERR("GetContentDOMWindow failed: %08x\n", nsres);
doc->basedoc.window = doc->nscontainer->content_window;
IHTMLWindow2_AddRef(&doc->basedoc.window->base.IHTMLWindow2_iface);
hres = create_outer_window(doc->nscontainer, mozwindow, NULL, &doc->basedoc.window);
if(FAILED(hres)) {
htmldoc_release(&doc->basedoc);
return hres;
}
doc->basedoc.window->doc_obj = doc;
if(!doc->basedoc.doc_node && doc->basedoc.window->base.inner_window->doc) {
doc->basedoc.doc_node = doc->basedoc.window->base.inner_window->doc;
......
......@@ -713,6 +713,8 @@ struct GeckoBrowser {
nsIBaseWindow *window;
nsIWebBrowserFocus *focus;
HTMLOuterWindow *content_window;
nsIEditor *editor;
nsIController *editor_controller;
......
......@@ -2029,9 +2029,11 @@ static const nsISupportsWeakReferenceVtbl nsSupportsWeakReferenceVtbl = {
static HRESULT init_browser(GeckoBrowser *browser)
{
mozIDOMWindowProxy *mozwindow;
nsIWebBrowserSetup *wbsetup;
nsIScrollable *scrollable;
nsresult nsres;
HRESULT hres;
nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr, NS_WEBBROWSER_CONTRACTID,
NULL, &IID_nsIWebBrowser, (void**)&browser->webbrowser);
......@@ -2132,7 +2134,15 @@ static HRESULT init_browser(GeckoBrowser *browser)
ERR("Could not get nsIScrollable: %08x\n", nsres);
}
return S_OK;
nsres = nsIWebBrowser_GetContentDOMWindow(browser->webbrowser, &mozwindow);
if(NS_FAILED(nsres)) {
ERR("GetContentDOMWindow failed: %08x\n", nsres);
return E_FAIL;
}
hres = create_outer_window(browser, mozwindow, NULL, &browser->content_window);
mozIDOMWindowProxy_Release(mozwindow);
return hres;
}
HRESULT create_gecko_browser(HTMLDocumentObj *doc, GeckoBrowser **_ret)
......@@ -2174,6 +2184,11 @@ void detach_gecko_browser(GeckoBrowser *This)
This->doc = NULL;
if(This->content_window) {
IHTMLWindow2_Release(&This->content_window->base.IHTMLWindow2_iface);
This->content_window = NULL;
}
while(!list_empty(&This->document_nodes)) {
HTMLDocumentNode *doc = LIST_ENTRY(list_head(&This->document_nodes), HTMLDocumentNode, browser_entry);
list_remove(&doc->browser_entry);
......
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