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

mshtml: Implement the remaining pre-response performance.timing props.

parent 020a020d
......@@ -513,6 +513,9 @@ typedef struct {
ULONGLONG unload_event_start_time;
ULONGLONG unload_event_end_time;
ULONGLONG redirect_time;
ULONGLONG dns_lookup_time;
ULONGLONG connect_time;
ULONGLONG request_time;
} HTMLPerformanceTiming;
typedef struct nsChannelBSC nsChannelBSC;
......
......@@ -1720,6 +1720,18 @@ static HRESULT nsChannelBSC_on_progress(BSCallback *bsc, ULONG progress, ULONG t
if(This->is_doc_channel && !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)
This->bsc.window->performance_timing->dns_lookup_time = get_time_stamp();
break;
case BINDSTATUS_CONNECTING:
if(This->is_doc_channel)
This->bsc.window->performance_timing->connect_time = get_time_stamp();
break;
case BINDSTATUS_SENDINGREQUEST:
if(This->is_doc_channel)
This->bsc.window->performance_timing->request_time = get_time_stamp();
break;
case BINDSTATUS_BEGINDOWNLOADDATA: {
IWinInetHttpInfo *http_info;
DWORD status, size = sizeof(DWORD);
......
......@@ -1587,6 +1587,24 @@ static HRESULT WINAPI HTMLPerformanceTiming_Invoke(IHTMLPerformanceTiming *iface
#define TIMING_FAKE_TIMESTAMP 0xdeadbeef
static ULONGLONG get_fetch_time(HTMLPerformanceTiming *This)
{
/* If there's no prior doc unloaded and no redirects, fetch time == navigationStart time */
if(!This->unload_event_end_time && !This->redirect_time)
return This->navigation_start_time;
if(This->dns_lookup_time)
return This->dns_lookup_time;
if(This->connect_time)
return This->connect_time;
if(This->request_time)
return This->request_time;
if(This->unload_event_end_time)
return This->unload_event_end_time;
return This->redirect_time;
}
static HRESULT WINAPI HTMLPerformanceTiming_get_navigationStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
{
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
......@@ -1631,9 +1649,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_redirectEnd(IHTMLPerformanceTimi
{
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
FIXME("(%p)->(%p) returning fake value\n", This, p);
TRACE("(%p)->(%p)\n", This, p);
*p = TIMING_FAKE_TIMESTAMP;
*p = This->redirect_time ? get_fetch_time(This) : 0;
return S_OK;
}
......@@ -1641,9 +1659,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_fetchStart(IHTMLPerformanceTimin
{
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
FIXME("(%p)->(%p) returning fake value\n", This, p);
TRACE("(%p)->(%p)\n", This, p);
*p = TIMING_FAKE_TIMESTAMP;
*p = get_fetch_time(This);
return S_OK;
}
......@@ -1651,9 +1669,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domainLookupStart(IHTMLPerforman
{
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
FIXME("(%p)->(%p) returning fake value\n", This, p);
TRACE("(%p)->(%p)\n", This, p);
*p = TIMING_FAKE_TIMESTAMP;
*p = This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
return S_OK;
}
......@@ -1661,9 +1679,10 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_domainLookupEnd(IHTMLPerformance
{
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
FIXME("(%p)->(%p) returning fake value\n", This, p);
TRACE("(%p)->(%p)\n", This, p);
*p = TIMING_FAKE_TIMESTAMP;
*p = This->connect_time ? This->connect_time :
This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
return S_OK;
}
......@@ -1671,9 +1690,10 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_connectStart(IHTMLPerformanceTim
{
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
FIXME("(%p)->(%p) returning fake value\n", This, p);
TRACE("(%p)->(%p)\n", This, p);
*p = TIMING_FAKE_TIMESTAMP;
*p = This->connect_time ? This->connect_time :
This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
return S_OK;
}
......@@ -1681,9 +1701,11 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_connectEnd(IHTMLPerformanceTimin
{
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
FIXME("(%p)->(%p) returning fake value\n", This, p);
TRACE("(%p)->(%p)\n", This, p);
*p = TIMING_FAKE_TIMESTAMP;
*p = This->request_time ? This->request_time :
This->connect_time ? This->connect_time :
This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
return S_OK;
}
......@@ -1691,9 +1713,11 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_requestStart(IHTMLPerformanceTim
{
HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
FIXME("(%p)->(%p) returning fake value\n", This, p);
TRACE("(%p)->(%p)\n", This, p);
*p = TIMING_FAKE_TIMESTAMP;
*p = This->request_time ? This->request_time :
This->connect_time ? This->connect_time :
This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
return S_OK;
}
......
......@@ -20,9 +20,16 @@ var compat_version;
var tests = [];
ok(performance.timing.navigationStart > 0, "navigationStart <= 0");
ok(performance.timing.fetchStart == performance.timing.navigationStart, "fetchStart != navigationStart");
ok(performance.timing.domainLookupStart >= performance.timing.fetchStart, "domainLookupStart < fetchStart");
ok(performance.timing.domainLookupEnd >= performance.timing.domainLookupStart, "domainLookupEnd < domainLookupStart");
ok(performance.timing.connectStart >= performance.timing.domainLookupEnd, "connectStart < domainLookupEnd");
ok(performance.timing.connectEnd >= performance.timing.connectStart, "connectEnd < connectStart");
ok(performance.timing.requestStart >= performance.timing.connectEnd, "requestStart < connectEnd");
ok(performance.timing.unloadEventStart === 0, "unloadEventStart != 0");
ok(performance.timing.unloadEventEnd === 0, "unloadEventEnd != 0");
ok(performance.timing.redirectStart === 0, "redirectStart != 0");
ok(performance.timing.redirectEnd === 0, "redirectEnd != 0");
var pageshow_fired = false, pagehide_fired = false;
document.doc_unload_events_called = false;
......
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