mshtml: Added IHTMLWindow2::get_length implementation.

This commit is contained in:
Jacek Caban 2009-10-13 00:41:28 +02:00 committed by Alexandre Julliard
parent 2d4236bfda
commit 3e0fa120a8
3 changed files with 49 additions and 3 deletions

View File

@ -177,8 +177,27 @@ static HRESULT WINAPI HTMLWindow2_item(IHTMLWindow2 *iface, VARIANT *pvarIndex,
static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, LONG *p)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
nsIDOMWindowCollection *nscollection;
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)

View File

@ -89,6 +89,7 @@ interface nsIDocumentStateListener;
interface nsIDOMCSSStyleSheet;
interface nsIDOMDocumentView;
interface nsIDocumentObserver;
interface nsIDOMWindow;
interface IMoniker;
@ -109,7 +110,6 @@ typedef nsISupports nsISHistory;
typedef nsISupports nsIWidget;
typedef nsISupports nsIHttpHeaderVisitor;
typedef nsISupports nsIDOMBarProp;
typedef nsISupports nsIDOMWindowCollection;
typedef nsISupports nsIPrompt;
typedef nsISupports nsIAuthPrompt;
typedef nsISupports nsIDOMNamedNodeMap;
@ -1106,6 +1106,19 @@ interface nsISelection : nsISupports
nsresult ToString(PRUnichar **_retval);
}
[
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),

View File

@ -851,6 +851,16 @@ static void _set_window_name(unsigned line, IHTMLWindow2 *window, const char *na
_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)
{
@ -4414,6 +4424,7 @@ static void test_window(IHTMLDocument2 *doc)
test_window_name(window, NULL);
set_window_name(window, "test");
test_window_length(window, 0);
IHTMLWindow2_Release(window);
}
@ -4648,6 +4659,8 @@ static void test_iframe_elem(IHTMLElement *elem)
ok(hres == S_OK, "get_contentWindow failed: %08x\n", hres);
ok(content_window != NULL, "contentWindow = NULL\n");
test_window_length(content_window, 0);
content_doc = NULL;
hres = IHTMLWindow2_get_document(content_window, &content_doc);
IHTMLWindow2_Release(content_window);
@ -5202,6 +5215,7 @@ static void test_elems(IHTMLDocument2 *doc)
window = get_doc_window(doc);
test_window_name(window, NULL);
set_window_name(window, "test name");
test_window_length(window, 1);
IHTMLWindow2_Release(window);
}