mshtml: Create top content window in init_browser.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-03-11 14:26:39 +01:00 committed by Alexandre Julliard
parent a007de5242
commit a3037ec2f2
3 changed files with 21 additions and 11 deletions

View File

@ -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;

View File

@ -713,6 +713,8 @@ struct GeckoBrowser {
nsIBaseWindow *window;
nsIWebBrowserFocus *focus;
HTMLOuterWindow *content_window;
nsIEditor *editor;
nsIController *editor_controller;

View File

@ -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);