Module: wine Branch: master Commit: bc8c1b5696aeb02ee34df31d47fb631c8db769c9 URL: https://gitlab.winehq.org/wine/wine/-/commit/bc8c1b5696aeb02ee34df31d47fb631...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Wed Nov 1 17:00:40 2023 +0200
mshtml/tests: Test parent window links after navigation.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/mshtml/tests/events.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index 7d139ccafe1..a55ebd8d26e 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -3234,6 +3234,48 @@ static void test_iframe_connections(IHTMLDocument2 *doc) IHTMLDocument2_Release(iframes_doc); }
+static void test_window_refs(IHTMLDocument2 *doc) +{ + IHTMLWindow2 *self, *parent, *child; + IHTMLFrameBase2 *iframe; + IHTMLDocument6 *doc6; + IHTMLElement2 *elem; + HRESULT hres; + BSTR bstr; + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument6, (void**)&doc6); + ok(hres == S_OK, "Could not get IHTMLDocument6 iface: %08lx\n", hres); + bstr = SysAllocString(L"ifr"); + hres = IHTMLDocument6_getElementById(doc6, bstr, &elem); + ok(hres == S_OK, "getElementById failed: %08lx\n", hres); + IHTMLDocument6_Release(doc6); + SysFreeString(bstr); + + hres = IHTMLElement2_QueryInterface(elem, &IID_IHTMLFrameBase2, (void**)&iframe); + ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08lx\n", hres); + IHTMLElement2_Release(elem); + hres = IHTMLFrameBase2_get_contentWindow(iframe, &child); + ok(hres == S_OK, "get_contentWindow failed: %08lx\n", hres); + IHTMLFrameBase2_Release(iframe); + + hres = IHTMLWindow2_get_self(window, &self); + ok(hres == S_OK, "get_self failed: %08lx\n", hres); + hres = IHTMLWindow2_get_parent(child, &parent); + ok(hres == S_OK, "get_parent failed: %08lx\n", hres); + ok(parent == self, "parent != self\n"); + IHTMLWindow2_Release(parent); + IHTMLWindow2_Release(self); + + navigate(doc, L"blank.html"); + + hres = IHTMLWindow2_get_parent(child, &parent); + ok(hres == S_OK, "get_parent failed: %08lx\n", hres); + ok(parent == child, "parent != child\n"); + + IHTMLWindow2_Release(parent); + IHTMLWindow2_Release(child); +} + static void test_doc_obj(IHTMLDocument2 *doc) { static DISPID propput_dispid = DISPID_PROPERTYPUT; @@ -6523,6 +6565,7 @@ START_TEST(events) run_test_from_res(L"doc_with_prop_ie9.html", test_visibilitychange); run_test_from_res(L"blank_ie10.html", test_visibilitychange); run_test_from_res(L"iframe.html", test_unload_event); + run_test_from_res(L"iframe.html", test_window_refs); run_test(empty_doc_ie9_str, test_create_event); run_test(img_doc_ie9_str, test_imgload); run_test(input_image_doc_ie9_str, test_inputload);