Jacek Caban : mshtml: Use document.defaultView to get iframe contentWindow.
Alexandre Julliard
julliard at winehq.org
Fri Oct 2 11:02:24 CDT 2009
Module: wine
Branch: master
Commit: b1a9b4fd2d014f95a16922caa2b3a1a534404303
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b1a9b4fd2d014f95a16922caa2b3a1a534404303
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Oct 2 13:53:52 2009 +0200
mshtml: Use document.defaultView to get iframe contentWindow.
---
dlls/mshtml/htmliframe.c | 40 +++++++++++++++++++++++++++++++++++++---
1 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c
index 5f3cafb..a482a5b 100644
--- a/dlls/mshtml/htmliframe.c
+++ b/dlls/mshtml/htmliframe.c
@@ -43,6 +43,40 @@ typedef struct {
#define HTMLFRAMEBASE2(x) (&(x)->lpIHTMLFrameBase2Vtbl)
+static HRESULT create_content_window(HTMLIFrame *This, nsIDOMHTMLDocument *nsdoc, HTMLWindow **ret)
+{
+ nsIDOMDocumentView *nsdocview;
+ nsIDOMAbstractView *nsview;
+ nsIDOMWindow *nswindow;
+ nsresult nsres;
+ HRESULT hres;
+
+ nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
+ if(NS_FAILED(nsres)) {
+ ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
+ return E_FAIL;
+ }
+
+ nsres = nsIDOMDocumentView_GetDefaultView(nsdocview, &nsview);
+ nsIDOMDocumentView_Release(nsdocview);
+ if(NS_FAILED(nsres)) {
+ ERR("GetDefaultView failed: %08x\n", nsres);
+ return E_FAIL;
+ }
+
+ nsres = nsIDOMAbstractView_QueryInterface(nsview, &IID_nsIDOMWindow, (void**)&nswindow);
+ nsIDOMAbstractView_Release(nsview);
+ if(NS_FAILED(nsres)) {
+ ERR("Coult not get nsIDOMWindow iface: %08x\n", nsres);
+ return E_FAIL;
+ }
+
+ hres = HTMLWindow_Create(This->element.node.doc->basedoc.doc_obj, nswindow, ret);
+
+ nsIDOMWindow_Release(nswindow);
+ return hres;
+}
+
#define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLFrameBase2, iface)
static HRESULT WINAPI HTMLIFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
@@ -130,10 +164,10 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface,
return E_FAIL;
}
- hres = HTMLWindow_Create(This->element.node.doc->basedoc.doc_obj, NULL, &window);
+ hres = create_content_window(This, nshtmldoc, &window);
if(FAILED(hres)) {
- nsIDOMDocument_Release(nsdoc);
- return hres;
+ nsIDOMHTMLDocument_Release(nshtmldoc);
+ return E_FAIL;
}
hres = create_doc_from_nsdoc(nshtmldoc, This->element.node.doc->basedoc.doc_obj, window, &content_doc);
More information about the wine-cvs
mailing list