Commit 5cedf9ca authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Don't create window in create_doc_from_nsdoc.

parent 4956e3ed
......@@ -1847,10 +1847,9 @@ static const htmldoc_vtbl_t HTMLDocumentNodeVtbl = {
HTMLDocumentNode_Release
};
HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentNode **ret)
HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLWindow *window, HTMLDocumentNode **ret)
{
HTMLDocumentNode *doc;
HRESULT hres;
doc = heap_alloc_zero(sizeof(HTMLDocumentNode));
if(!doc)
......@@ -1862,11 +1861,8 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentNode **ret)
nsIDOMHTMLDocument_AddRef(nsdoc);
doc->basedoc.nsdoc = nsdoc;
hres = HTMLWindow_Create(&doc->basedoc, NULL, &doc->basedoc.window);
if(FAILED(hres)) {
htmldoc_release(&doc->basedoc);
return hres;
}
IHTMLWindow2_AddRef(HTMLWINDOW2(window));
doc->basedoc.window = window;
*ret = doc;
return S_OK;
......@@ -1946,7 +1942,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
ERR("GetContentDOMWindow failed: %08x\n", nsres);
}
hres = HTMLWindow_Create(&doc->basedoc, nswindow, &doc->basedoc.window);
hres = HTMLWindow_Create(nswindow, &doc->basedoc.window);
if(nswindow)
nsIDOMWindow_Release(nswindow);
if(FAILED(hres)) {
......@@ -1954,6 +1950,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
return hres;
}
doc->basedoc.window->doc = &doc->basedoc;
get_thread_hwnd();
return S_OK;
......
......@@ -107,6 +107,7 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface,
if(!This->content_doc) {
nsIDOMHTMLDocument *nshtmldoc;
nsIDOMDocument *nsdoc;
HTMLWindow *window;
nsresult nsres;
HRESULT hres;
......@@ -128,7 +129,16 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface,
return E_FAIL;
}
hres = create_doc_from_nsdoc(nshtmldoc, &This->content_doc);
hres = HTMLWindow_Create(NULL, &window);
if(FAILED(hres)) {
nsIDOMDocument_Release(nsdoc);
return hres;
}
hres = create_doc_from_nsdoc(nshtmldoc, window, &This->content_doc);
if(SUCCEEDED(hres))
window->doc = &This->content_doc->basedoc;
IHTMLWindow2_Release(HTMLWINDOW2(window));
nsIDOMHTMLDocument_Release(nshtmldoc);
if(FAILED(hres))
return hres;
......
......@@ -1413,7 +1413,7 @@ static dispex_static_data_t HTMLWindow_dispex = {
HTMLWindow_iface_tids
};
HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow **ret)
HRESULT HTMLWindow_Create(nsIDOMWindow *nswindow, HTMLWindow **ret)
{
HTMLWindow *window;
......@@ -1425,7 +1425,6 @@ HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow
window->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl;
window->lpIDispatchExVtbl = &WindowDispExVtbl;
window->ref = 1;
window->doc = doc;
init_dispex(&window->dispex, (IUnknown*)HTMLWINDOW2(window), &HTMLWindow_dispex);
......
......@@ -540,9 +540,9 @@ typedef struct {
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentNode**);
HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLWindow*,HTMLDocumentNode**);
HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
HRESULT HTMLWindow_Create(nsIDOMWindow*,HTMLWindow**);
HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow*);
HRESULT HTMLLocation_Create(HTMLWindow*,HTMLLocation**);
......
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