mshtml: Added IHTMLWindow2::get_location implementation.
authorJacek Caban <jacek@codeweavers.com>
Sat, 3 Jan 2009 16:45:47 +0000 (17:45 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Sun, 4 Jan 2009 12:32:47 +0000 (13:32 +0100)
dlls/mshtml/htmlwindow.c
dlls/mshtml/tests/dom.c

index b73811a9ecbd75614fd7c7cf68dc8a0bbc7d8513..979ed53e3ee7531d9f287b7aa4756e9fe0a8ae72 100644 (file)
@@ -248,8 +248,15 @@ static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageEleme
 static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocation **p)
 {
     HTMLWindow *This = HTMLWINDOW2_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(!This->doc) {
+        FIXME("This->doc is NULL\n");
+        return E_FAIL;
+    }
+
+    return IHTMLDocument2_get_location(HTMLDOC(This->doc), p);
 }
 
 static HRESULT WINAPI HTMLWindow2_get_history(IHTMLWindow2 *iface, IOmHistory **p)
index aa8dbb8d4e6643cddc3e55bb998c4af323f48905..de363bb1a7b55e420c80e0aa564cdabeccdf9aec 100644 (file)
@@ -2185,6 +2185,7 @@ static void test_compatmode(IHTMLDocument2 *doc)
 static void test_location(IHTMLDocument2 *doc)
 {
     IHTMLLocation *location, *location2;
+    IHTMLWindow2 *window;
     ULONG ref;
     HRESULT hres;
 
@@ -2195,10 +2196,18 @@ static void test_location(IHTMLDocument2 *doc)
     ok(hres == S_OK, "get_location failed: %08x\n", hres);
 
     ok(location == location2, "location != location2\n");
+    IHTMLLocation_Release(location2);
 
-    test_ifaces((IUnknown*)location, location_iids);
+    hres = IHTMLDocument2_get_parentWindow(doc, &window);
+    ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
 
+    hres = IHTMLWindow2_get_location(window, &location2);
+    ok(hres == S_OK, "get_location failed: %08x\n", hres);
+    ok(location == location2, "location != location2\n");
     IHTMLLocation_Release(location2);
+
+    test_ifaces((IUnknown*)location, location_iids);
+
     ref = IHTMLLocation_Release(location);
     ok(!ref, "location chould be destroyed here\n");
 }