mshtml: Implement performance.timing.loadEventStart & loadEventEnd.

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 6fa4c42608
commit 72b13c5ab8
4 changed files with 15 additions and 4 deletions

View file

@ -522,6 +522,8 @@ typedef struct {
ULONGLONG dom_complete_time;
ULONGLONG dom_content_loaded_event_start_time;
ULONGLONG dom_content_loaded_event_end_time;
ULONGLONG load_event_start_time;
ULONGLONG load_event_end_time;
} HTMLPerformanceTiming;
typedef struct nsChannelBSC nsChannelBSC;

View file

@ -363,6 +363,8 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
IDocObjectService_FireDocumentComplete(doc_obj->doc_object_service,
&doc->outer_window->base.IHTMLWindow2_iface, 0);
doc->window->performance_timing->load_event_start_time = get_time_stamp();
if(doc->dom_document) {
hres = create_document_event(doc, EVENTID_LOAD, &load_event);
if(SUCCEEDED(hres)) {
@ -379,6 +381,8 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
IDOMEvent_Release(&load_event->IDOMEvent_iface);
}
doc->window->performance_timing->load_event_end_time = get_time_stamp();
IHTMLDOMNode_Release(&doc->node.IHTMLDOMNode_iface);
return NS_OK;
}

View file

@ -1796,9 +1796,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_loadEventStart(IHTMLPerformanceT
{
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->load_event_start_time;
return S_OK;
}
@ -1806,9 +1806,9 @@ static HRESULT WINAPI HTMLPerformanceTiming_get_loadEventEnd(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->load_event_end_time;
return S_OK;
}

View file

@ -33,6 +33,8 @@ ok(performance.timing.domInteractive === 0, "domInteractive != 0");
ok(performance.timing.domComplete === 0, "domComplete != 0");
ok(performance.timing.domContentLoadedEventStart === 0, "domContentLoadedEventStart != 0");
ok(performance.timing.domContentLoadedEventEnd === 0, "domContentLoadedEventEnd != 0");
ok(performance.timing.loadEventStart === 0, "loadEventStart != 0");
ok(performance.timing.loadEventEnd === 0, "loadEventEnd != 0");
ok(performance.timing.unloadEventStart === 0, "unloadEventStart != 0");
ok(performance.timing.unloadEventEnd === 0, "unloadEventEnd != 0");
ok(performance.timing.redirectStart === 0, "redirectStart != 0");
@ -59,6 +61,7 @@ if(window.addEventListener) {
ok(r === "[object PageTransitionEvent]", "pageshow toString = " + r);
ok("persisted" in e, "'persisted' not in pageshow event");
ok(document.readyState === "complete", "pageshow readyState = " + document.readyState);
ok(performance.timing.loadEventEnd > 0, "loadEventEnd <= 0 in pageshow handler");
}, true);
window.addEventListener("pagehide", function(e) {
@ -84,6 +87,8 @@ sync_test("performance timing", function() {
ok(performance.timing.domContentLoadedEventStart >= performance.timing.domInteractive, "domContentLoadedEventStart < domInteractive");
ok(performance.timing.domContentLoadedEventEnd >= performance.timing.domContentLoadedEventStart, "domContentLoadedEventEnd < domContentLoadedEventStart");
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");
});
sync_test("page transition events", function() {