Commit 2dcb37e5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use nsIDOMWindowCollection::NamedItem in get_window_by_name.

parent a5354174
...@@ -360,6 +360,8 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H ...@@ -360,6 +360,8 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H
{ {
nsIDOMWindowCollection *nsframes; nsIDOMWindowCollection *nsframes;
HTMLOuterWindow *window = NULL; HTMLOuterWindow *window = NULL;
nsIDOMWindow *nswindow;
nsAString name_str;
PRUint32 length, i; PRUint32 length, i;
nsresult nsres; nsresult nsres;
HRESULT hres = S_OK; HRESULT hres = S_OK;
...@@ -370,12 +372,24 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H ...@@ -370,12 +372,24 @@ HRESULT get_frame_by_name(HTMLOuterWindow *This, const WCHAR *name, BOOL deep, H
return E_FAIL; 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); nsres = nsIDOMWindowCollection_GetLength(nsframes, &length);
assert(nsres == NS_OK); assert(nsres == NS_OK);
for(i = 0; i < length && !window; ++i) { for(i = 0; i < length && !window; ++i) {
HTMLOuterWindow *window_iter; HTMLOuterWindow *window_iter;
nsIDOMWindow *nswindow;
BSTR id; BSTR id;
nsres = nsIDOMWindowCollection_Item(nsframes, i, &nswindow); nsres = nsIDOMWindowCollection_Item(nsframes, i, &nswindow);
......
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