mshtml: Implement performance.timing.responseStart & responseEnd.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-11-22 18:26:22 +02:00 committed by Alexandre Julliard
parent 0118f3608f
commit 3de9f679d6
4 changed files with 24 additions and 11 deletions

View file

@ -516,6 +516,8 @@ typedef struct {
ULONGLONG dns_lookup_time;
ULONGLONG connect_time;
ULONGLONG request_time;
ULONGLONG response_start_time;
ULONGLONG response_end_time;
} HTMLPerformanceTiming;
typedef struct nsChannelBSC nsChannelBSC;

View file

@ -1107,6 +1107,9 @@ static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
if(!This->response_processed) {
IWinInetHttpInfo *wininet_info;
if(This->is_doc_channel)
This->bsc.window->performance_timing->response_start_time = get_time_stamp();
This->response_processed = TRUE;
if(This->bsc.binding) {
hres = IBinding_QueryInterface(This->bsc.binding, &IID_IWinInetHttpInfo, (void**)&wininet_info);
@ -1522,13 +1525,16 @@ static HRESULT nsChannelBSC_stop_binding(BSCallback *bsc, HRESULT result)
{
nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
if(result != E_ABORT && This->is_doc_channel && This->bsc.window) {
if(FAILED(result))
handle_navigation_error(This, result);
else if(This->nschannel) {
result = async_stop_request(This);
if(SUCCEEDED(result))
return S_OK;
if(This->is_doc_channel && This->bsc.window) {
This->bsc.window->performance_timing->response_end_time = get_time_stamp();
if(result != E_ABORT) {
if(FAILED(result))
handle_navigation_error(This, result);
else if(This->nschannel) {
result = async_stop_request(This);
if(SUCCEEDED(result))
return S_OK;
}
}
}
@ -1786,6 +1792,9 @@ static HRESULT nsChannelBSC_on_response(BSCallback *bsc, DWORD response_code,
char *str;
HRESULT hres;
if(This->is_doc_channel)
This->bsc.window->performance_timing->response_start_time = get_time_stamp();
This->response_processed = TRUE;
This->nschannel->response_status = response_code;

View file

@ -1725,9 +1725,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_responseStart(IHTMLPerformanceTi
{
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->response_start_time;
return S_OK;
}
@ -1735,9 +1735,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_responseEnd(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->response_end_time;
return S_OK;
}

View file

@ -26,6 +26,8 @@ ok(performance.timing.domainLookupEnd >= performance.timing.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.responseStart >= performance.timing.requestStart, "responseStart < requestStart");
ok(performance.timing.responseEnd >= performance.timing.responseStart, "responseEnd < responseStart");
ok(performance.timing.unloadEventStart === 0, "unloadEventStart != 0");
ok(performance.timing.unloadEventEnd === 0, "unloadEventEnd != 0");
ok(performance.timing.redirectStart === 0, "redirectStart != 0");