Commit a44ce98d authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Implement performance.navigation.type.

parent 2e0a5d42
...@@ -508,6 +508,7 @@ typedef struct { ...@@ -508,6 +508,7 @@ typedef struct {
LONG ref; LONG ref;
ULONG navigation_type;
ULONG redirect_count; ULONG redirect_count;
ULONGLONG navigation_start_time; ULONGLONG navigation_start_time;
......
...@@ -1361,6 +1361,13 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc) ...@@ -1361,6 +1361,13 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc)
nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc); nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
if(This->is_doc_channel) { 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->base.outer_window->base.inner_window->doc->skip_mutation_notif = FALSE;
This->bsc.window->performance_timing->navigation_start_time = get_time_stamp(); This->bsc.window->performance_timing->navigation_start_time = get_time_stamp();
} }
......
...@@ -1996,9 +1996,9 @@ static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigat ...@@ -1996,9 +1996,9 @@ static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigat
{ {
HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface); 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; return S_OK;
} }
......
...@@ -90,6 +90,7 @@ sync_test("performance timing", function() { ...@@ -90,6 +90,7 @@ sync_test("performance timing", function() {
ok(performance.timing.domComplete >= performance.timing.domContentLoadedEventEnd, "domComplete < domContentLoadedEventEnd"); ok(performance.timing.domComplete >= performance.timing.domContentLoadedEventEnd, "domComplete < domContentLoadedEventEnd");
ok(performance.timing.loadEventStart >= performance.timing.domComplete, "loadEventStart < domComplete"); ok(performance.timing.loadEventStart >= performance.timing.domComplete, "loadEventStart < domComplete");
ok(performance.timing.loadEventEnd >= performance.timing.loadEventStart, "loadEventEnd < loadEventStart"); 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); ok(performance.navigation.redirectCount === 0, "redirectCount = " + performance.navigation.redirectCount);
}); });
......
...@@ -219,7 +219,7 @@ static BOOL set_clientsite, container_locked; ...@@ -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 readystate_set_loading = FALSE, readystate_set_interactive = FALSE, load_from_stream;
static BOOL editmode = FALSE, ignore_external_qi; static BOOL editmode = FALSE, ignore_external_qi;
static BOOL inplace_deactivated, open_call; 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 DWORD status_code = HTTP_STATUS_OK;
static BOOL asynchronous_binding = FALSE; static BOOL asynchronous_binding = FALSE;
static BOOL support_wbapp, allow_new_window, no_travellog; static BOOL support_wbapp, allow_new_window, no_travellog;
...@@ -529,6 +529,63 @@ static void _test_performance_timing(unsigned line, IUnknown *unk, const WCHAR * ...@@ -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)); 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) static BSTR get_mime_type_display_name(const WCHAR *content_type)
{ {
WCHAR buffer[128], ext[128], *str, *progid; WCHAR buffer[128], ext[128], *str, *progid;
...@@ -1119,6 +1176,9 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D ...@@ -1119,6 +1176,9 @@ static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, D
test_readyState(NULL); test_readyState(NULL);
readystate_set_interactive = (load_state != LD_INTERACTIVE); 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 */ /* w10pro64_ja has it set to zero despite readyState being interactive, for whatever reason */
if(!is_mhtml) if(!is_mhtml)
test_performance_timing(doc_unk, L"domInteractive"); test_performance_timing(doc_unk, L"domInteractive");
...@@ -2987,6 +3047,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID ...@@ -2987,6 +3047,7 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
ok(nCmdexecopt == 0, "nCmdexecopts=%08lx\n", nCmdexecopt); ok(nCmdexecopt == 0, "nCmdexecopts=%08lx\n", nCmdexecopt);
ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut); ok(pvaOut == NULL, "pvaOut=%p\n", pvaOut);
ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn); ok(pvaIn == NULL, "pvaIn=%p\n", pvaIn);
test_navigation_type(doc_unk);
test_performance_timing(doc_unk, L"domComplete"); test_performance_timing(doc_unk, L"domComplete");
readystate_set_loading = FALSE; readystate_set_loading = FALSE;
readystate_set_interactive = FALSE; readystate_set_interactive = FALSE;
...@@ -3661,6 +3722,7 @@ static HRESULT WINAPI DocObjectService_FireNavigateComplete2( ...@@ -3661,6 +3722,7 @@ static HRESULT WINAPI DocObjectService_FireNavigateComplete2(
{ {
CHECK_EXPECT(FireNavigateComplete2); CHECK_EXPECT(FireNavigateComplete2);
test_readyState(NULL); test_readyState(NULL);
test_navigation_type(doc_unk);
test_performance_timing(doc_unk, L"domInteractive"); test_performance_timing(doc_unk, L"domInteractive");
if(loading_hash) if(loading_hash)
...@@ -4508,6 +4570,7 @@ static HRESULT WINAPI WebBrowserPriv_NavigateWithBindCtx(IWebBrowserPriv *iface, ...@@ -4508,6 +4570,7 @@ static HRESULT WINAPI WebBrowserPriv_NavigateWithBindCtx(IWebBrowserPriv *iface,
trace("NavigateWithBindCtx\n"); trace("NavigateWithBindCtx\n");
CHECK_EXPECT(NavigateWithBindCtx); CHECK_EXPECT(NavigateWithBindCtx);
test_navigation_type(doc_unk);
ok(V_VT(uri) == VT_BSTR, "V_VT(uri) = %d\n", V_VT(uri)); 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); 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) ...@@ -5890,6 +5953,7 @@ static void test_download(DWORD flags)
else else
b = &called_Exec_HTTPEQUIV_DONE; b = &called_Exec_HTTPEQUIV_DONE;
is_refresh = (flags & DWL_REFRESH) != 0; is_refresh = (flags & DWL_REFRESH) != 0;
is_from_hist = (flags & DWL_FROM_HISTORY) != 0;
hwnd = FindWindowA("Internet Explorer_Hidden", NULL); hwnd = FindWindowA("Internet Explorer_Hidden", NULL);
ok(hwnd != NULL, "Could not find hidden window\n"); ok(hwnd != NULL, "Could not find hidden window\n");
......
...@@ -20,6 +20,7 @@ var tests = []; ...@@ -20,6 +20,7 @@ var tests = [];
async_test("reload", function() { async_test("reload", function() {
if(sessionStorage.getItem("skip reload test")) { if(sessionStorage.getItem("skip reload test")) {
ok(performance.navigation.type === 1, "navigation type = " + performance.navigation.type);
next_test(); next_test();
return; return;
} }
......
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