Jacek Caban : mshtml: Use nsIDOMWindowCollection:: NamedItem in get_window_by_name.

Alexandre Julliard julliard at winehq.org
Mon Sep 3 13:19:14 CDT 2012


Module: wine
Branch: master
Commit: 2dcb37e5203c68c4db99f7045729639021d0357a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=2dcb37e5203c68c4db99f7045729639021d0357a

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Sep  3 12:52:27 2012 +0200

mshtml: Use nsIDOMWindowCollection::NamedItem in get_window_by_name.

---

 dlls/mshtml/htmlwindow.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 1a12acc..2ec4a7f 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -360,6 +360,8 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H
 {
     nsIDOMWindowCollection *nsframes;
     HTMLOuterWindow *window = NULL;
+    nsIDOMWindow *nswindow;
+    nsAString name_str;
     PRUint32 length, i;
     nsresult nsres;
     HRESULT hres = S_OK;
@@ -370,12 +372,24 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H
         return E_FAIL;
     }
 
+    nsAString_InitDepend(&name_str, name);
+    nsres = nsIDOMWindowCollection_NamedItem(nsframes, &name_str, &nswindow);
+    nsAString_Finish(&name_str);
+    if(NS_FAILED(nsres)) {
+        nsIDOMWindowCollection_Release(nsframes);
+        return E_FAIL;
+    }
+
+    if(nswindow) {
+        *ret = nswindow_to_window(nswindow);
+        return S_OK;
+    }
+
     nsres = nsIDOMWindowCollection_GetLength(nsframes, &length);
     assert(nsres == NS_OK);
 
     for(i = 0; i < length && !window; ++i) {
         HTMLOuterWindow *window_iter;
-        nsIDOMWindow *nswindow;
         BSTR id;
 
         nsres = nsIDOMWindowCollection_Item(nsframes, i, &nswindow);




More information about the wine-cvs mailing list