summaryrefslogtreecommitdiffstats
path: root/dom/performance/PerformanceResourceTiming.cpp
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-04-29 14:44:20 +0200
committerGitHub <noreply@github.com>2018-04-29 14:44:20 +0200
commit6fe08dcf34417e825b7b9b6b33141a4a3b46ba24 (patch)
treef5d213986dcdb7c281e23ce93e176b7ca9fca92c /dom/performance/PerformanceResourceTiming.cpp
parentdc35e5c26dfa8c7fe6d27f7bc96f7a6e3c02de9b (diff)
parente040ed925030f899f845d458c226f7e439f4ec8b (diff)
downloadUXP-6fe08dcf34417e825b7b9b6b33141a4a3b46ba24.tar
UXP-6fe08dcf34417e825b7b9b6b33141a4a3b46ba24.tar.gz
UXP-6fe08dcf34417e825b7b9b6b33141a4a3b46ba24.tar.lz
UXP-6fe08dcf34417e825b7b9b6b33141a4a3b46ba24.tar.xz
UXP-6fe08dcf34417e825b7b9b6b33141a4a3b46ba24.zip
Merge pull request #293 from janekptacijarabaci/js_dom_performance-resource-timing_1
moebius#158: The Performance Resource Timing (added support for "workerStart")
Diffstat (limited to 'dom/performance/PerformanceResourceTiming.cpp')
-rw-r--r--dom/performance/PerformanceResourceTiming.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/dom/performance/PerformanceResourceTiming.cpp b/dom/performance/PerformanceResourceTiming.cpp
index 60a20ca28..94df27408 100644
--- a/dom/performance/PerformanceResourceTiming.cpp
+++ b/dom/performance/PerformanceResourceTiming.cpp
@@ -42,8 +42,22 @@ PerformanceResourceTiming::~PerformanceResourceTiming()
DOMHighResTimeStamp
PerformanceResourceTiming::StartTime() const
{
- DOMHighResTimeStamp startTime = mTiming->RedirectStartHighRes();
- return startTime ? startTime : mTiming->FetchStartHighRes();
+ // Force the start time to be the earliest of:
+ // - RedirectStart
+ // - WorkerStart
+ // - AsyncOpen
+ // Ignore zero values. The RedirectStart and WorkerStart values
+ // can come from earlier redirected channels prior to the AsyncOpen
+ // time being recorded.
+ DOMHighResTimeStamp redirect = mTiming->RedirectStartHighRes();
+ redirect = redirect ? redirect : DBL_MAX;
+
+ DOMHighResTimeStamp worker = mTiming->WorkerStartHighRes();
+ worker = worker ? worker : DBL_MAX;
+
+ DOMHighResTimeStamp asyncOpen = mTiming->AsyncOpenHighRes();
+
+ return std::min(asyncOpen, std::min(redirect, worker));
}
JSObject*