From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/navigate.c | 7 +++++-- dlls/mshtml/omnavigator.c | 24 ++++++++++++++++-------- dlls/mshtml/tests/documentmode.js | 1 + 4 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c1d2cacd776..7dffea3528f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -508,6 +508,8 @@ typedef struct {
LONG ref;
+ ULONG redirect_count; + ULONGLONG navigation_start_time; ULONGLONG unload_event_start_time; ULONGLONG unload_event_end_time; diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 20eea5024d6..c69d4a5a0b2 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -1723,8 +1723,11 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG progress, ULONG t This->nschannel->content_type = strdupWtoA(status_text); break; case BINDSTATUS_REDIRECTING: - if(This->is_doc_channel && !This->bsc.window->performance_timing->redirect_time) - This->bsc.window->performance_timing->redirect_time = get_time_stamp(); + if(This->is_doc_channel) { + This->bsc.window->performance_timing->redirect_count++; + if(!This->bsc.window->performance_timing->redirect_time) + This->bsc.window->performance_timing->redirect_time = get_time_stamp(); + } return handle_redirect(This, status_text); case BINDSTATUS_FINDINGRESOURCE: if(This->is_doc_channel && !This->bsc.window->performance_timing->dns_lookup_time) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index c36673430d0..ff1e8061bc2 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1901,6 +1901,7 @@ typedef struct { IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface;
LONG ref; + HTMLPerformanceTiming *timing; } HTMLPerformanceNavigation;
static inline HTMLPerformanceNavigation *impl_from_IHTMLPerformanceNavigation(IHTMLPerformanceNavigation *iface) @@ -1948,6 +1949,7 @@ static ULONG WINAPI HTMLPerformanceNavigation_Release(IHTMLPerformanceNavigation TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { + IHTMLPerformanceTiming_Release(&This->timing->IHTMLPerformanceTiming_iface); release_dispex(&This->dispex); free(This); } @@ -2003,8 +2005,11 @@ static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigat static HRESULT WINAPI HTMLPerformanceNavigation_get_redirectCount(IHTMLPerformanceNavigation *iface, ULONG *p) { HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + *p = This->timing->redirect_count; + return S_OK; }
static HRESULT WINAPI HTMLPerformanceNavigation_toString(IHTMLPerformanceNavigation *iface, BSTR *string) @@ -2055,7 +2060,7 @@ typedef struct { LONG ref;
IHTMLPerformanceNavigation *navigation; - IHTMLPerformanceTiming *timing; + HTMLPerformanceTiming *timing; } HTMLPerformance;
static inline HTMLPerformance *impl_from_IHTMLPerformance(IHTMLPerformance *iface) @@ -2103,7 +2108,7 @@ static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface) TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { - IHTMLPerformanceTiming_Release(This->timing); + IHTMLPerformanceTiming_Release(&This->timing->IHTMLPerformanceTiming_iface); if(This->navigation) IHTMLPerformanceNavigation_Release(This->navigation); release_dispex(&This->dispex); @@ -2164,6 +2169,9 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface,
navigation->IHTMLPerformanceNavigation_iface.lpVtbl = &HTMLPerformanceNavigationVtbl; navigation->ref = 1; + navigation->timing = This->timing; + IHTMLPerformanceTiming_AddRef(&This->timing->IHTMLPerformanceTiming_iface); + init_dispatch(&navigation->dispex, (IUnknown*)&navigation->IHTMLPerformanceNavigation_iface, &HTMLPerformanceNavigation_dispex, dispex_compat_mode(&This->dispex));
@@ -2180,7 +2188,7 @@ static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLP
TRACE("(%p)->(%p)\n", This, p);
- IHTMLPerformanceTiming_AddRef(*p = This->timing); + IHTMLPerformanceTiming_AddRef(*p = &This->timing->IHTMLPerformanceTiming_iface); return S_OK; }
@@ -2240,10 +2248,10 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface, &HTMLPerformance_dispex, compat_mode);
- performance->timing = &window->performance_timing->IHTMLPerformanceTiming_iface; - IHTMLPerformanceTiming_AddRef(performance->timing); + performance->timing = window->performance_timing; + IHTMLPerformanceTiming_AddRef(&performance->timing->IHTMLPerformanceTiming_iface);
- init_dispatch(&window->performance_timing->dispex, (IUnknown*)&window->performance_timing->IHTMLPerformanceTiming_iface, + init_dispatch(&performance->timing->dispex, (IUnknown*)&performance->timing->IHTMLPerformanceTiming_iface, &HTMLPerformanceTiming_dispex, compat_mode);
*ret = &performance->IHTMLPerformance_iface; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 3965c8ec41b..a1f0a6bd6a6 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.redirectCount === 0, "redirectCount = " + performance.navigation.redirectCount); });
sync_test("page transition events", function() {