Title: [280454] trunk
Revision
280454
Author
[email protected]
Date
2021-07-29 16:02:09 -0700 (Thu, 29 Jul 2021)

Log Message

[ Mac ] fast/dom/webtiming-document-open.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=228571

Reviewed by Chris Dumez.

Source/WebCore:

In r278391 I made PerformanceTiming::monotonicTimeToIntegerMilliseconds call MonotonicTime::approximateWallTime,
which, if called multiple times, can give slightly different values, usually differing by 1 (millisecond, in this case).
To fix this, cache the value from the first call.  This uses an additional 168 bytes per frame in pages that use PerformanceTiming.
Once bug 227336 is turned on and the web is given a year or so to move to that replacement API, this whole API will be removed.

* page/PerformanceTiming.cpp:
(WebCore::PerformanceTiming::navigationStart const):
(WebCore::PerformanceTiming::unloadEventStart const):
(WebCore::PerformanceTiming::unloadEventEnd const):
(WebCore::PerformanceTiming::redirectStart const):
(WebCore::PerformanceTiming::redirectEnd const):
(WebCore::PerformanceTiming::fetchStart const):
(WebCore::PerformanceTiming::domainLookupStart const):
(WebCore::PerformanceTiming::domainLookupEnd const):
(WebCore::PerformanceTiming::connectStart const):
(WebCore::PerformanceTiming::connectEnd const):
(WebCore::PerformanceTiming::secureConnectionStart const):
(WebCore::PerformanceTiming::requestStart const):
(WebCore::PerformanceTiming::responseStart const):
(WebCore::PerformanceTiming::responseEnd const):
(WebCore::PerformanceTiming::domLoading const):
(WebCore::PerformanceTiming::domInteractive const):
(WebCore::PerformanceTiming::domContentLoadedEventStart const):
(WebCore::PerformanceTiming::domContentLoadedEventEnd const):
(WebCore::PerformanceTiming::domComplete const):
(WebCore::PerformanceTiming::loadEventStart const):
(WebCore::PerformanceTiming::loadEventEnd const):
* page/PerformanceTiming.h:

LayoutTests:

* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (280453 => 280454)


--- trunk/LayoutTests/ChangeLog	2021-07-29 22:52:27 UTC (rev 280453)
+++ trunk/LayoutTests/ChangeLog	2021-07-29 23:02:09 UTC (rev 280454)
@@ -1,3 +1,12 @@
+2021-07-29  Alex Christensen  <[email protected]>
+
+        [ Mac ] fast/dom/webtiming-document-open.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=228571
+
+        Reviewed by Chris Dumez.
+
+        * platform/mac/TestExpectations:
+
 2021-07-29  Ayumi Kojima  <[email protected]>
 
         [ iOS ] 2 http/tests/cookies/same-site tests are flaky timing out.

Modified: trunk/LayoutTests/platform/mac/TestExpectations (280453 => 280454)


--- trunk/LayoutTests/platform/mac/TestExpectations	2021-07-29 22:52:27 UTC (rev 280453)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2021-07-29 23:02:09 UTC (rev 280454)
@@ -2363,7 +2363,5 @@
 [ Monterey ] model-element/model-element-graphics-layers-opacity.html [ Pass Failure ]
 [ Monterey Debug arm64 ] imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-restartIce.https.html [ Pass Failure Crash ]
 
-webkit.org/b/228571 fast/dom/webtiming-document-open.html [ Pass Failure ]
-
 webkit.org/b/228396 fast/speechsynthesis/speech-synthesis-speak-empty-string.html [ Pass Failure ]
 

Modified: trunk/Source/WebCore/ChangeLog (280453 => 280454)


--- trunk/Source/WebCore/ChangeLog	2021-07-29 22:52:27 UTC (rev 280453)
+++ trunk/Source/WebCore/ChangeLog	2021-07-29 23:02:09 UTC (rev 280454)
@@ -1,3 +1,39 @@
+2021-07-29  Alex Christensen  <[email protected]>
+
+        [ Mac ] fast/dom/webtiming-document-open.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=228571
+
+        Reviewed by Chris Dumez.
+
+        In r278391 I made PerformanceTiming::monotonicTimeToIntegerMilliseconds call MonotonicTime::approximateWallTime,
+        which, if called multiple times, can give slightly different values, usually differing by 1 (millisecond, in this case).
+        To fix this, cache the value from the first call.  This uses an additional 168 bytes per frame in pages that use PerformanceTiming.
+        Once bug 227336 is turned on and the web is given a year or so to move to that replacement API, this whole API will be removed.
+
+        * page/PerformanceTiming.cpp:
+        (WebCore::PerformanceTiming::navigationStart const):
+        (WebCore::PerformanceTiming::unloadEventStart const):
+        (WebCore::PerformanceTiming::unloadEventEnd const):
+        (WebCore::PerformanceTiming::redirectStart const):
+        (WebCore::PerformanceTiming::redirectEnd const):
+        (WebCore::PerformanceTiming::fetchStart const):
+        (WebCore::PerformanceTiming::domainLookupStart const):
+        (WebCore::PerformanceTiming::domainLookupEnd const):
+        (WebCore::PerformanceTiming::connectStart const):
+        (WebCore::PerformanceTiming::connectEnd const):
+        (WebCore::PerformanceTiming::secureConnectionStart const):
+        (WebCore::PerformanceTiming::requestStart const):
+        (WebCore::PerformanceTiming::responseStart const):
+        (WebCore::PerformanceTiming::responseEnd const):
+        (WebCore::PerformanceTiming::domLoading const):
+        (WebCore::PerformanceTiming::domInteractive const):
+        (WebCore::PerformanceTiming::domContentLoadedEventStart const):
+        (WebCore::PerformanceTiming::domContentLoadedEventEnd const):
+        (WebCore::PerformanceTiming::domComplete const):
+        (WebCore::PerformanceTiming::loadEventStart const):
+        (WebCore::PerformanceTiming::loadEventEnd const):
+        * page/PerformanceTiming.h:
+
 2021-07-29  Michael Catanzaro  <[email protected]>
 
         -Wreturn-type warning in SQLiteDatabase.cpp

Modified: trunk/Source/WebCore/page/PerformanceTiming.cpp (280453 => 280454)


--- trunk/Source/WebCore/page/PerformanceTiming.cpp	2021-07-29 22:52:27 UTC (rev 280453)
+++ trunk/Source/WebCore/page/PerformanceTiming.cpp	2021-07-29 23:02:09 UTC (rev 280454)
@@ -50,15 +50,22 @@
 
 unsigned long long PerformanceTiming::navigationStart() const
 {
+    if (m_navigationStart)
+        return m_navigationStart;
+
     auto* timing = documentLoadTiming();
     if (!timing)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->startTime());
+    m_navigationStart = monotonicTimeToIntegerMilliseconds(timing->startTime());
+    return m_navigationStart;
 }
 
 unsigned long long PerformanceTiming::unloadEventStart() const
 {
+    if (m_unloadEventStart)
+        return m_unloadEventStart;
+
     auto* timing = documentLoadTiming();
     if (!timing)
         return 0;
@@ -70,11 +77,15 @@
     if (metrics->failsTAOCheck || !timing->hasSameOriginAsPreviousDocument())
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->unloadEventStart());
+    m_unloadEventStart = monotonicTimeToIntegerMilliseconds(timing->unloadEventStart());
+    return m_unloadEventStart;
 }
 
 unsigned long long PerformanceTiming::unloadEventEnd() const
 {
+    if (m_unloadEventEnd)
+        return m_unloadEventEnd;
+
     auto* timing = documentLoadTiming();
     if (!timing)
         return 0;
@@ -86,11 +97,15 @@
     if (metrics->failsTAOCheck || !timing->hasSameOriginAsPreviousDocument())
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->unloadEventEnd());
+    m_unloadEventEnd = monotonicTimeToIntegerMilliseconds(timing->unloadEventEnd());
+    return m_unloadEventEnd;
 }
 
 unsigned long long PerformanceTiming::redirectStart() const
 {
+    if (m_redirectStart)
+        return m_redirectStart;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics
         || metrics->failsTAOCheck
@@ -97,11 +112,15 @@
         || !metrics->redirectCount)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(metrics->redirectStart);
+    m_redirectStart = monotonicTimeToIntegerMilliseconds(metrics->redirectStart);
+    return m_redirectStart;
 }
 
 unsigned long long PerformanceTiming::redirectEnd() const
 {
+    if (m_redirectEnd)
+        return m_redirectEnd;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics
         || metrics->failsTAOCheck
@@ -108,57 +127,81 @@
         || !metrics->redirectCount)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(metrics->fetchStart);
+    m_redirectEnd = monotonicTimeToIntegerMilliseconds(metrics->fetchStart);
+    return m_redirectEnd;
 }
 
 unsigned long long PerformanceTiming::fetchStart() const
 {
+    if (m_fetchStart)
+        return m_fetchStart;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(metrics->fetchStart);
+    m_fetchStart = monotonicTimeToIntegerMilliseconds(metrics->fetchStart);
+    return m_fetchStart;
 }
 
 unsigned long long PerformanceTiming::domainLookupStart() const
 {
+    if (m_domainLookupStart)
+        return m_domainLookupStart;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics || !metrics->domainLookupStart)
         return fetchStart();
 
-    return monotonicTimeToIntegerMilliseconds(metrics->domainLookupStart);
+    m_domainLookupStart = monotonicTimeToIntegerMilliseconds(metrics->domainLookupStart);
+    return m_domainLookupStart;
 }
 
 unsigned long long PerformanceTiming::domainLookupEnd() const
 {
+    if (m_domainLookupEnd)
+        return m_domainLookupEnd;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics || !metrics->domainLookupEnd)
         return domainLookupStart();
 
-    return monotonicTimeToIntegerMilliseconds(metrics->domainLookupEnd);
+    m_domainLookupEnd = monotonicTimeToIntegerMilliseconds(metrics->domainLookupEnd);
+    return m_domainLookupEnd;
 }
 
 unsigned long long PerformanceTiming::connectStart() const
 {
+    if (m_connectStart)
+        return m_connectStart;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics || !metrics->connectStart
         || metrics->domainLookupEnd.secondsSinceEpoch() > metrics->connectStart.secondsSinceEpoch())
         return domainLookupEnd();
 
-    return monotonicTimeToIntegerMilliseconds(metrics->connectStart);
+    m_connectStart = monotonicTimeToIntegerMilliseconds(metrics->connectStart);
+    return m_connectStart;
 }
 
 unsigned long long PerformanceTiming::connectEnd() const
 {
+    if (m_connectEnd)
+        return m_connectEnd;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics || !metrics->connectEnd)
         return connectStart();
 
-    return monotonicTimeToIntegerMilliseconds(metrics->connectEnd);
+    m_connectEnd = monotonicTimeToIntegerMilliseconds(metrics->connectEnd);
+    return m_connectEnd;
 }
 
 unsigned long long PerformanceTiming::secureConnectionStart() const
 {
+    if (m_secureConnectionStart)
+        return m_secureConnectionStart;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics)
         return connectEnd();
@@ -167,97 +210,138 @@
         || metrics->secureConnectionStart == reusedTLSConnectionSentinel)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(metrics->secureConnectionStart);
+    m_secureConnectionStart = monotonicTimeToIntegerMilliseconds(metrics->secureConnectionStart);
+    return m_secureConnectionStart;
 }
 
 unsigned long long PerformanceTiming::requestStart() const
 {
+    if (m_requestStart)
+        return m_requestStart;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics || !metrics->requestStart)
         return connectEnd();
     
-    return monotonicTimeToIntegerMilliseconds(metrics->requestStart);
+    m_requestStart = monotonicTimeToIntegerMilliseconds(metrics->requestStart);
+    return m_requestStart;
 }
 
 unsigned long long PerformanceTiming::responseStart() const
 {
+    if (m_responseStart)
+        return m_responseStart;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics || !metrics->responseStart)
         return requestStart();
 
-    return monotonicTimeToIntegerMilliseconds(metrics->responseStart);
+    m_responseStart = monotonicTimeToIntegerMilliseconds(metrics->responseStart);
+    return m_responseStart;
 }
 
 unsigned long long PerformanceTiming::responseEnd() const
 {
+    if (m_responseEnd)
+        return m_responseEnd;
+
     auto* metrics = networkLoadMetrics();
     if (!metrics || !metrics->responseEnd)
         return responseStart();
 
-    return monotonicTimeToIntegerMilliseconds(metrics->responseEnd);
+    m_responseEnd = monotonicTimeToIntegerMilliseconds(metrics->responseEnd);
+    return m_responseEnd;
 }
 
 unsigned long long PerformanceTiming::domLoading() const
 {
+    if (m_domLoading)
+        return m_domLoading;
+
     auto* timing = documentEventTiming();
     if (!timing)
         return fetchStart();
 
-    return monotonicTimeToIntegerMilliseconds(timing->domLoading);
+    m_domLoading = monotonicTimeToIntegerMilliseconds(timing->domLoading);
+    return m_domLoading;
 }
 
 unsigned long long PerformanceTiming::domInteractive() const
 {
+    if (m_domInteractive)
+        return m_domInteractive;
+
     auto* timing = documentEventTiming();
     if (!timing)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->domInteractive);
+    m_domInteractive = monotonicTimeToIntegerMilliseconds(timing->domInteractive);
+    return m_domInteractive;
 }
 
 unsigned long long PerformanceTiming::domContentLoadedEventStart() const
 {
+    if (m_domContentLoadedEventStart)
+        return m_domContentLoadedEventStart;
+
     auto* timing = documentEventTiming();
     if (!timing)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventStart);
+    m_domContentLoadedEventStart = monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventStart);
+    return m_domContentLoadedEventStart;
 }
 
 unsigned long long PerformanceTiming::domContentLoadedEventEnd() const
 {
+    if (m_domContentLoadedEventEnd)
+        return m_domContentLoadedEventEnd;
+
     auto* timing = documentEventTiming();
     if (!timing)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventEnd);
+    m_domContentLoadedEventEnd = monotonicTimeToIntegerMilliseconds(timing->domContentLoadedEventEnd);
+    return m_domContentLoadedEventEnd;
 }
 
 unsigned long long PerformanceTiming::domComplete() const
 {
+    if (m_domComplete)
+        return m_domComplete;
+
     auto* timing = documentEventTiming();
     if (!timing)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->domComplete);
+    m_domComplete = monotonicTimeToIntegerMilliseconds(timing->domComplete);
+    return m_domComplete;
 }
 
 unsigned long long PerformanceTiming::loadEventStart() const
 {
+    if (m_loadEventStart)
+        return m_loadEventStart;
+
     auto* timing = documentLoadTiming();
     if (!timing)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->loadEventStart());
+    m_loadEventStart = monotonicTimeToIntegerMilliseconds(timing->loadEventStart());
+    return m_loadEventStart;
 }
 
 unsigned long long PerformanceTiming::loadEventEnd() const
 {
+    if (m_loadEventEnd)
+        return m_loadEventEnd;
+
     auto* timing = documentLoadTiming();
     if (!timing)
         return 0;
 
-    return monotonicTimeToIntegerMilliseconds(timing->loadEventEnd());
+    m_loadEventEnd = monotonicTimeToIntegerMilliseconds(timing->loadEventEnd());
+    return m_loadEventEnd;
 }
 
 const DocumentLoader* PerformanceTiming::documentLoader() const

Modified: trunk/Source/WebCore/page/PerformanceTiming.h (280453 => 280454)


--- trunk/Source/WebCore/page/PerformanceTiming.h	2021-07-29 22:52:27 UTC (rev 280453)
+++ trunk/Source/WebCore/page/PerformanceTiming.h	2021-07-29 23:02:09 UTC (rev 280454)
@@ -78,6 +78,28 @@
     const DocumentLoadTiming* documentLoadTiming() const;
     const NetworkLoadMetrics* networkLoadMetrics() const;
     unsigned long long monotonicTimeToIntegerMilliseconds(MonotonicTime) const;
+
+    mutable unsigned long long m_navigationStart { 0 };
+    mutable unsigned long long m_unloadEventStart { 0 };
+    mutable unsigned long long m_unloadEventEnd { 0 };
+    mutable unsigned long long m_redirectStart { 0 };
+    mutable unsigned long long m_redirectEnd { 0 };
+    mutable unsigned long long m_fetchStart { 0 };
+    mutable unsigned long long m_domainLookupStart { 0 };
+    mutable unsigned long long m_domainLookupEnd { 0 };
+    mutable unsigned long long m_connectStart { 0 };
+    mutable unsigned long long m_connectEnd { 0 };
+    mutable unsigned long long m_secureConnectionStart { 0 };
+    mutable unsigned long long m_requestStart { 0 };
+    mutable unsigned long long m_responseStart { 0 };
+    mutable unsigned long long m_responseEnd { 0 };
+    mutable unsigned long long m_domLoading { 0 };
+    mutable unsigned long long m_domInteractive { 0 };
+    mutable unsigned long long m_domContentLoadedEventStart { 0 };
+    mutable unsigned long long m_domContentLoadedEventEnd { 0 };
+    mutable unsigned long long m_domComplete { 0 };
+    mutable unsigned long long m_loadEventStart { 0 };
+    mutable unsigned long long m_loadEventEnd { 0 };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to