Module: wine Branch: master Commit: a44ce98d10e25c2e88d06daf3ae8a4b8fadb50d3 URL: https://gitlab.winehq.org/wine/wine/-/commit/a44ce98d10e25c2e88d06daf3ae8a4b...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Fri Nov 25 19:10:03 2022 +0200
mshtml: Implement performance.navigation.type.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/navigate.c | 7 +++++ dlls/mshtml/omnavigator.c | 4 +-- dlls/mshtml/tests/documentmode.js | 1 + dlls/mshtml/tests/htmldoc.c | 66 ++++++++++++++++++++++++++++++++++++++- dlls/mshtml/tests/reload.js | 1 + 6 files changed, 77 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7dffea3528f..af1c50c5091 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -508,6 +508,7 @@ typedef struct {
LONG ref;
+ ULONG navigation_type; ULONG redirect_count;
ULONGLONG navigation_start_time; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index c69d4a5a0b2..fa6a09c31e3 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1361,6 +1361,13 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc) nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
if(This->is_doc_channel) { + DWORD flags = This->bsc.window->base.outer_window->load_flags; + + if(flags & BINDING_FROMHIST) + This->bsc.window->performance_timing->navigation_type = 2; /* TYPE_BACK_FORWARD */ + if(flags & BINDING_REFRESH) + This->bsc.window->performance_timing->navigation_type = 1; /* TYPE_RELOAD */ + This->bsc.window->base.outer_window->base.inner_window->doc->skip_mutation_notif = FALSE; This->bsc.window->performance_timing->navigation_start_time = get_time_stamp(); } diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index ff1e8061bc2..aa9f33567c2 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1996,9 +1996,9 @@ static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigat { HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
- FIXME("(%p)->(%p) returning TYPE_NAVIGATE\n", This, p); + TRACE("(%p)->(%p)\n", This, p);
- *p = 0; /* TYPE_NAVIGATE */ + *p = This->timing->navigation_type; return S_OK; }
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index a1f0a6bd6a6..8fd97d11cd6 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -90,6 +90,7 @@ sync_test("performance timing", function() { ok(performance.timing.domComplete >= performance.timing.domContentLoadedEventEnd, "domComplete < domContentLoadedEventEnd"); ok(performance.timing.loadEventStart >= performance.timing.domComplete, "loadEventStart < domComplete"); ok(performance.timing.loadEventEnd >= performance.timing.loadEventStart, "loadEventEnd < loadEventStart"); + ok(performance.navigation.type === 0, "navigation type = " + performance.navigation.type); ok(performance.navigation.redirectCount === 0, "redirectCount = " + performance.navigation.redirectCount); });
diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index a4a2207d4d2..b4971e5784d 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -219,7 +219,7 @@ static BOOL set_clientsite, container_locked; static BOOL readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream; static BOOL editmode = FALSE, ignore_external_qi; static BOOL inplace_deactivated, open_call; -static BOOL complete, loading_js, loading_hash, is_refresh; +static BOOL complete, loading_js, loading_hash, is_refresh, is_from_hist; static DWORD status_code = HTTP_STATUS_OK; static BOOL asynchronous_binding = FALSE; static BOOL support_wbapp, allow_new_window, no_travellog; @@ -529,6 +529,63 @@ static void _test_performance_timing(unsigned line, IUnknown *unk, const WCHAR * ok_(__FILE__,line)(V_UI8(&var) == 0, "%s is not 0\n", wine_dbgstr_w(prop)); }
+#define test_navigation_type(a) _test_navigation_type(__LINE__,a) +static void _test_navigation_type(unsigned line, IUnknown *unk) +{ + IHTMLPerformanceNavigation *nav; + IHTMLPerformance *perf; + DISPPARAMS dp = { 0 }; + ULONG type, expected; + IHTMLWindow2 *window; + IHTMLDocument2 *doc; + IDispatchEx *dispex; + DISPID dispid; + HRESULT hres; + VARIANT var; + BSTR bstr; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc); + ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08lx\n", hres); + + hres = IHTMLDocument2_get_parentWindow(doc, &window); + ok_(__FILE__,line)(hres == S_OK, "get_parentWindow failed: %08lx\n", hres); + IHTMLDocument2_Release(doc); + + hres = IHTMLWindow2_QueryInterface(window, &IID_IDispatchEx, (void**)&dispex); + ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IDispatchEx) failed: %08lx\n", hres); + IHTMLWindow2_Release(window); + + bstr = SysAllocString(L"performance"); + hres = IDispatchEx_GetDispID(dispex, bstr, fdexNameCaseSensitive, &dispid); + ok_(__FILE__,line)(hres == S_OK, "GetDispID(performance) failed: %08lx\n", hres); + SysFreeString(bstr); + + V_VT(&var) = VT_EMPTY; + hres = IDispatchEx_InvokeEx(dispex, dispid, 0, DISPATCH_PROPERTYGET, &dp, &var, NULL, NULL); + ok_(__FILE__,line)(hres == S_OK, "InvokeEx(performance) failed: %08lx\n", hres); + ok_(__FILE__,line)(V_VT(&var) == VT_DISPATCH, "V_VT(performance) = %d\n", V_VT(&var)); + ok_(__FILE__,line)(V_DISPATCH(&var) != NULL, "V_DISPATCH(performance) = NULL\n"); + IDispatchEx_Release(dispex); + + hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLPerformance, (void**)&perf); + ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLPerformance) failed: %08lx\n", hres); + ok_(__FILE__,line)(perf != NULL, "performance is NULL\n"); + VariantClear(&var); + + hres = IHTMLPerformance_get_navigation(perf, &nav); + ok_(__FILE__,line)(hres == S_OK, "get_navigation failed: %08lx\n", hres); + ok_(__FILE__,line)(nav != NULL, "performance.navigation is NULL\n"); + IHTMLPerformance_Release(perf); + + hres = IHTMLPerformanceNavigation_get_type(nav, &type); + ok_(__FILE__,line)(hres == S_OK, "get_type failed: %08lx\n", hres); + IHTMLPerformanceNavigation_Release(nav); + + expected = is_refresh || editmode ? 1 : is_from_hist ? 2 : 0; + todo_wine_if(editmode) + ok_(__FILE__,line)(type == expected, "type = %lu, expected %lu\n", type, expected); +} + static BSTR get_mime_type_display_name(const WCHAR *content_type) { WCHAR buffer[128], ext[128], *str, *progid; @@ -1119,6 +1176,9 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D test_readyState(NULL); readystate_set_interactive = (load_state != LD_INTERACTIVE);
+ if((!is_refresh && !editmode) || called_Exec_ShellDocView_37) + test_navigation_type(doc_unk); + /* w10pro64_ja has it set to zero despite readyState being interactive, for whatever reason */ if(!is_mhtml) test_performance_timing(doc_unk, L"domInteractive"); @@ -2987,6 +3047,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ok(nCmdexecopt == 0, "nCmdexecopts=%08lx\n", nCmdexecopt); ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut); ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn); + test_navigation_type(doc_unk); test_performance_timing(doc_unk, L"domComplete"); readystate_set_loading = FALSE; readystate_set_interactive = FALSE; @@ -3661,6 +3722,7 @@ static HRESULT WINAPI DocObjectService_FireNavigateComplete2( { CHECK_EXPECT(FireNavigateComplete2); test_readyState(NULL); + test_navigation_type(doc_unk); test_performance_timing(doc_unk, L"domInteractive");
if(loading_hash) @@ -4508,6 +4570,7 @@ static HRESULT WINAPI WebBrowserPriv_NavigateWithBindCtx(IWebBrowserPriv *iface, trace("NavigateWithBindCtx\n");
CHECK_EXPECT(NavigateWithBindCtx); + test_navigation_type(doc_unk);
ok(V_VT(uri) == VT_BSTR, "V_VT(uri) = %d\n", V_VT(uri)); test_NavigateWithBindCtx(V_BSTR(uri), flags, target_frame, post_data, headers, bind_ctx, url_fragment); @@ -5890,6 +5953,7 @@ static void test_download(DWORD flags) else b = &called_Exec_HTTPEQUIV_DONE; is_refresh = (flags & DWL_REFRESH) != 0; + is_from_hist = (flags & DWL_FROM_HISTORY) != 0;
hwnd = FindWindowA("Internet Explorer_Hidden", NULL); ok(hwnd != NULL, "Could not find hidden window\n"); diff --git a/dlls/mshtml/tests/reload.js b/dlls/mshtml/tests/reload.js index 04bdf9fcb90..ebd207c14a5 100644 --- a/dlls/mshtml/tests/reload.js +++ b/dlls/mshtml/tests/reload.js @@ -20,6 +20,7 @@ var tests = [];
async_test("reload", function() { if(sessionStorage.getItem("skip reload test")) { + ok(performance.navigation.type === 1, "navigation type = " + performance.navigation.type); next_test(); return; }