Commit 676d4af4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Move GetContentDOMWindow call from HTMLWindow_Create.

parent b5aa4dd8
...@@ -1551,6 +1551,7 @@ static dispex_static_data_t HTMLDocument_dispex = { ...@@ -1551,6 +1551,7 @@ static dispex_static_data_t HTMLDocument_dispex = {
HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
{ {
nsIDOMWindow *nswindow;
HTMLDocument *ret; HTMLDocument *ret;
HRESULT hres; HRESULT hres;
...@@ -1596,7 +1597,12 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) ...@@ -1596,7 +1597,12 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
ret->nscontainer = NSContainer_Create(ret, NULL); ret->nscontainer = NSContainer_Create(ret, NULL);
update_nsdocument(ret); update_nsdocument(ret);
ret->window = HTMLWindow_Create(ret); if(ret->nscontainer)
nsIWebBrowser_GetContentDOMWindow(ret->nscontainer->webbrowser, &nswindow);
HTMLWindow_Create(ret, nswindow, &ret->window);
if(nswindow)
nsIDOMWindow_Release(nswindow);
get_thread_hwnd(); get_thread_hwnd();
......
...@@ -1182,29 +1182,31 @@ static dispex_static_data_t HTMLWindow_dispex = { ...@@ -1182,29 +1182,31 @@ static dispex_static_data_t HTMLWindow_dispex = {
HTMLWindow_iface_tids HTMLWindow_iface_tids
}; };
HTMLWindow *HTMLWindow_Create(HTMLDocument *doc) HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow **ret)
{ {
HTMLWindow *ret = heap_alloc_zero(sizeof(HTMLWindow)); HTMLWindow *window;
ret->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl; window = heap_alloc_zero(sizeof(HTMLWindow));
ret->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl; if(!window)
ret->lpIDispatchExVtbl = &WindowDispExVtbl; return E_OUTOFMEMORY;
ret->ref = 1;
ret->doc = doc;
init_dispex(&ret->dispex, (IUnknown*)HTMLWINDOW2(ret), &HTMLWindow_dispex); window->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl;
window->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl;
window->lpIDispatchExVtbl = &WindowDispExVtbl;
window->ref = 1;
window->doc = doc;
if(doc->nscontainer) { init_dispex(&window->dispex, (IUnknown*)HTMLWINDOW2(window), &HTMLWindow_dispex);
nsresult nsres;
nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &ret->nswindow); if(nswindow) {
if(NS_FAILED(nsres)) nsIDOMWindow_AddRef(nswindow);
ERR("GetContentDOMWindow failed: %08x\n", nsres); window->nswindow = nswindow;
} }
list_add_head(&window_list, &ret->entry); list_add_head(&window_list, &window->entry);
return ret; *ret = window;
return S_OK;
} }
HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow) HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow)
......
...@@ -460,7 +460,7 @@ typedef struct { ...@@ -460,7 +460,7 @@ typedef struct {
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**); HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**); HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
HTMLWindow *HTMLWindow_Create(HTMLDocument*); HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
HTMLWindow *nswindow_to_window(const nsIDOMWindow*); HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*); HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
HTMLLocation *HTMLLocation_Create(HTMLDocument*); HTMLLocation *HTMLLocation_Create(HTMLDocument*);
......
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