Title: [292055] branches/safari-613-branch/Source
- Revision
- 292055
- Author
- [email protected]
- Date
- 2022-03-29 12:15:42 -0700 (Tue, 29 Mar 2022)
Log Message
Navigation Timing data is corrupt in WebView (UIWebView/WKWebView)
https://bugs.webkit.org/show_bug.cgi?id=186919
<rdar://41393423>
Reviewed by Simon Fraser.
Source/WebCore:
Sometimes the observed requestStart time is after the observed responseStart time.
This may be due to the device's clock changing. It may be due to something else,
but currently CFNetwork does not use a monotonic timer to gather the data.
When this happens, use the later of the two times for responseStart.
* platform/network/cocoa/NetworkLoadMetrics.mm:
(WebCore::packageTimingData):
Source/WebKit:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
Modified Paths
Diff
Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (292054 => 292055)
--- branches/safari-613-branch/Source/WebCore/ChangeLog 2022-03-29 19:10:01 UTC (rev 292054)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog 2022-03-29 19:15:42 UTC (rev 292055)
@@ -1,3 +1,19 @@
+2022-03-29 Alex Christensen <[email protected]>
+
+ Navigation Timing data is corrupt in WebView (UIWebView/WKWebView)
+ https://bugs.webkit.org/show_bug.cgi?id=186919
+ <rdar://41393423>
+
+ Reviewed by Simon Fraser.
+
+ Sometimes the observed requestStart time is after the observed responseStart time.
+ This may be due to the device's clock changing. It may be due to something else,
+ but currently CFNetwork does not use a monotonic timer to gather the data.
+ When this happens, use the later of the two times for responseStart.
+
+ * platform/network/cocoa/NetworkLoadMetrics.mm:
+ (WebCore::packageTimingData):
+
2022-03-29 Alan Coon <[email protected]>
Cherry-pick r292042. rdar://problem/89434696
Modified: branches/safari-613-branch/Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm (292054 => 292055)
--- branches/safari-613-branch/Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm 2022-03-29 19:10:01 UTC (rev 292054)
+++ branches/safari-613-branch/Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm 2022-03-29 19:15:42 UTC (rev 292055)
@@ -54,7 +54,8 @@
timing->secureConnectionStart = dateToMonotonicTime(secureConnectionStart);
timing->connectEnd = dateToMonotonicTime(connectEnd);
timing->requestStart = dateToMonotonicTime(requestStart);
- timing->responseStart = dateToMonotonicTime(responseStart);
+ // Sometimes, likely because of <rdar://90997689>, responseStart is before requestStart. If this happens, use the later of the two.
+ timing->responseStart = std::max(timing->requestStart, dateToMonotonicTime(responseStart));
timing->redirectCount = redirectCount;
timing->failsTAOCheck = failsTAOCheck;
timing->hasCrossOriginRedirect = hasCrossOriginRedirect;
Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (292054 => 292055)
--- branches/safari-613-branch/Source/WebKit/ChangeLog 2022-03-29 19:10:01 UTC (rev 292054)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog 2022-03-29 19:15:42 UTC (rev 292055)
@@ -1,3 +1,14 @@
+2022-03-29 Alex Christensen <[email protected]>
+
+ Navigation Timing data is corrupt in WebView (UIWebView/WKWebView)
+ https://bugs.webkit.org/show_bug.cgi?id=186919
+ <rdar://41393423>
+
+ Reviewed by Simon Fraser.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
+
2022-03-29 Alan Coon <[email protected]>
Cherry-pick r292042. rdar://problem/89434696
Modified: branches/safari-613-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (292054 => 292055)
--- branches/safari-613-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2022-03-29 19:10:01 UTC (rev 292054)
+++ branches/safari-613-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2022-03-29 19:15:42 UTC (rev 292055)
@@ -835,7 +835,8 @@
networkLoadMetrics.secureConnectionStart = dateToMonotonicTime(m.secureConnectionStartDate);
networkLoadMetrics.connectEnd = dateToMonotonicTime(m.connectEndDate);
networkLoadMetrics.requestStart = dateToMonotonicTime(m.requestStartDate);
- networkLoadMetrics.responseStart = dateToMonotonicTime(m.responseStartDate);
+ // Sometimes, likely because of <rdar://90997689>, responseStart is before requestStart. If this happens, use the later of the two.
+ networkLoadMetrics.responseStart = std::max(networkLoadMetrics.requestStart, dateToMonotonicTime(m.responseStartDate));
networkLoadMetrics.responseEnd = dateToMonotonicTime(m.responseEndDate);
networkLoadMetrics.markComplete();
networkLoadMetrics.redirectCount = metrics.redirectCount;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes