Commit 3e0fa120 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLWindow2::get_length implementation.

parent 2d4236bf
...@@ -177,8 +177,27 @@ static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex, ...@@ -177,8 +177,27 @@ static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex,
static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, LONG *p) static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, LONG *p)
{ {
HTMLWindow *This = HTMLWINDOW2_THIS(iface); HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%p)\n", This, p); nsIDOMWindowCollection *nscollection;
return E_NOTIMPL; PRUint32 length;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMWindow_GetFrames(This->nswindow, &nscollection);
if(NS_FAILED(nsres)) {
ERR("GetFrames failed: %08x\n", nsres);
return E_FAIL;
}
nsres = nsIDOMWindowCollection_GetLength(nscollection, &length);
nsIDOMWindowCollection_Release(nscollection);
if(NS_FAILED(nsres)) {
ERR("GetLength failed: %08x\n", nsres);
return E_FAIL;
}
*p = length;
return S_OK;
} }
static HRESULT WINAPI HTMLWindow2_get_frames(IHTMLWindow2 *iface, IHTMLFramesCollection2 **p) static HRESULT WINAPI HTMLWindow2_get_frames(IHTMLWindow2 *iface, IHTMLFramesCollection2 **p)
......
...@@ -89,6 +89,7 @@ interface nsIDocumentStateListener; ...@@ -89,6 +89,7 @@ interface nsIDocumentStateListener;
interface nsIDOMCSSStyleSheet; interface nsIDOMCSSStyleSheet;
interface nsIDOMDocumentView; interface nsIDOMDocumentView;
interface nsIDocumentObserver; interface nsIDocumentObserver;
interface nsIDOMWindow;
interface IMoniker; interface IMoniker;
...@@ -109,7 +110,6 @@ typedef nsISupports nsISHistory; ...@@ -109,7 +110,6 @@ typedef nsISupports nsISHistory;
typedef nsISupports nsIWidget; typedef nsISupports nsIWidget;
typedef nsISupports nsIHttpHeaderVisitor; typedef nsISupports nsIHttpHeaderVisitor;
typedef nsISupports nsIDOMBarProp; typedef nsISupports nsIDOMBarProp;
typedef nsISupports nsIDOMWindowCollection;
typedef nsISupports nsIPrompt; typedef nsISupports nsIPrompt;
typedef nsISupports nsIAuthPrompt; typedef nsISupports nsIAuthPrompt;
typedef nsISupports nsIDOMNamedNodeMap; typedef nsISupports nsIDOMNamedNodeMap;
...@@ -1108,6 +1108,19 @@ interface nsISelection : nsISupports ...@@ -1108,6 +1108,19 @@ interface nsISelection : nsISupports
[ [
object, object,
uuid(a6cf906f-15b3-11d2-932e-00805f8add32),
local
/* FROZEN */
]
interface nsIDOMWindowCollection : nsISupports
{
nsresult GetLength(PRUint32 *aLength);
nsresult Item(PRUint32 index, nsIDOMWindow **_retval);
nsresult NamedItem(const nsAString *name, nsIDOMWindow **_retval);
}
[
object,
uuid(a6cf906b-15b3-11d2-932e-00805f8add32), uuid(a6cf906b-15b3-11d2-932e-00805f8add32),
local local
/* FROZEN */ /* FROZEN */
......
...@@ -851,6 +851,16 @@ static void _set_window_name(unsigned line, IHTMLWindow2 *window, const char *na ...@@ -851,6 +851,16 @@ static void _set_window_name(unsigned line, IHTMLWindow2 *window, const char *na
_test_window_name(line, window, name); _test_window_name(line, window, name);
} }
#define test_window_length(w,l) _test_window_length(__LINE__,w,l)
static void _test_window_length(unsigned line, IHTMLWindow2 *window, LONG exlen)
{
LONG length = -1;
HRESULT hres;
hres = IHTMLWindow2_get_length(window, &length);
ok_(__FILE__,line)(hres == S_OK, "get_length failed: %08x\n", hres);
ok_(__FILE__,line)(length == exlen, "length = %d, expected %d\n", length, exlen);
}
static void test_get_set_attr(IHTMLDocument2 *doc) static void test_get_set_attr(IHTMLDocument2 *doc)
{ {
...@@ -4414,6 +4424,7 @@ static void test_window(IHTMLDocument2 *doc) ...@@ -4414,6 +4424,7 @@ static void test_window(IHTMLDocument2 *doc)
test_window_name(window, NULL); test_window_name(window, NULL);
set_window_name(window, "test"); set_window_name(window, "test");
test_window_length(window, 0);
IHTMLWindow2_Release(window); IHTMLWindow2_Release(window);
} }
...@@ -4648,6 +4659,8 @@ static void test_iframe_elem(IHTMLElement *elem) ...@@ -4648,6 +4659,8 @@ static void test_iframe_elem(IHTMLElement *elem)
ok(hres == S_OK, "get_contentWindow failed: %08x\n", hres); ok(hres == S_OK, "get_contentWindow failed: %08x\n", hres);
ok(content_window != NULL, "contentWindow = NULL\n"); ok(content_window != NULL, "contentWindow = NULL\n");
test_window_length(content_window, 0);
content_doc = NULL; content_doc = NULL;
hres = IHTMLWindow2_get_document(content_window, &content_doc); hres = IHTMLWindow2_get_document(content_window, &content_doc);
IHTMLWindow2_Release(content_window); IHTMLWindow2_Release(content_window);
...@@ -5202,6 +5215,7 @@ static void test_elems(IHTMLDocument2 *doc) ...@@ -5202,6 +5215,7 @@ static void test_elems(IHTMLDocument2 *doc)
window = get_doc_window(doc); window = get_doc_window(doc);
test_window_name(window, NULL); test_window_name(window, NULL);
set_window_name(window, "test name"); set_window_name(window, "test name");
test_window_length(window, 1);
IHTMLWindow2_Release(window); IHTMLWindow2_Release(window);
} }
......
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