Diff
Modified: trunk/Source/WebCore/ChangeLog (213916 => 213917)
--- trunk/Source/WebCore/ChangeLog 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/ChangeLog 2017-03-14 18:19:47 UTC (rev 213917)
@@ -1,3 +1,37 @@
+2017-03-14 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: More accurate Resource Timing data in Web Inspector
+ https://bugs.webkit.org/show_bug.cgi?id=169577
+
+ Reviewed by Youenn Fablet.
+
+ * inspector/InspectorNetworkAgent.h:
+ * inspector/InspectorNetworkAgent.cpp:
+ (WebCore::InspectorNetworkAgent::didFinishLoading):
+ Use the ResourceLoader to get the start time that responseEnd is relative to
+ so we can send the more accurate responseEnd when available.
+
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
+ * inspector/InspectorInstrumentation.h:
+ (WebCore::InspectorInstrumentation::didFinishLoading):
+ * loader/CrossOriginPreflightChecker.cpp:
+ (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::finishedLoading):
+ * loader/ResourceLoadNotifier.cpp:
+ (WebCore::ResourceLoadNotifier::didFinishLoad):
+ (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
+ (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
+ * loader/ResourceLoadNotifier.h:
+ * loader/appcache/ApplicationCacheGroup.cpp:
+ (WebCore::ApplicationCacheGroup::didFinishLoading):
+ Pass ResourceLoader through to Web Inspector in didFinishLoading.
+
+ * platform/network/cocoa/NetworkLoadMetrics.mm:
+ (WebCore::copyTimingData):
+ The differences from the reference start are in Seconds, not milliseconds.
+
2017-03-14 Wenson Hsieh <wenson_hs...@apple.com>
[WK2] Data interaction tests occasionally hit assertions in debug builds
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (213916 => 213917)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2017-03-14 18:19:47 UTC (rev 213917)
@@ -599,13 +599,13 @@
networkAgent->didReceiveData(identifier, data, dataLength, encodedDataLength);
}
-void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const NetworkLoadMetrics& networkLoadMetrics)
+void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const NetworkLoadMetrics& networkLoadMetrics, ResourceLoader* resourceLoader)
{
if (!loader)
return;
if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
- networkAgent->didFinishLoading(identifier, *loader, networkLoadMetrics);
+ networkAgent->didFinishLoading(identifier, *loader, networkLoadMetrics, resourceLoader);
}
void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (213916 => 213917)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h 2017-03-14 18:19:47 UTC (rev 213917)
@@ -157,7 +157,7 @@
static void didReceiveResourceResponse(Frame&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
static void didReceiveThreadableLoaderResponse(DocumentThreadableLoader&, unsigned long identifier);
static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
- static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, const NetworkLoadMetrics&);
+ static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, const NetworkLoadMetrics&, ResourceLoader*);
static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
static void continueAfterXFrameOptionsDenied(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&);
static void continueWithPolicyDownload(Frame&, unsigned long identifier, DocumentLoader&, const ResourceResponse&);
@@ -327,7 +327,7 @@
static void didReceiveResourceResponseImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*);
static void didReceiveThreadableLoaderResponseImpl(InstrumentingAgents&, DocumentThreadableLoader&, unsigned long identifier);
static void didReceiveDataImpl(InstrumentingAgents&, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
- static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const NetworkLoadMetrics&);
+ static void didFinishLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const NetworkLoadMetrics&, ResourceLoader*);
static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&);
static void didFinishXHRLoadingImpl(InstrumentingAgents&, unsigned long identifier, std::optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&);
@@ -858,10 +858,10 @@
didReceiveDataImpl(*instrumentingAgents, identifier, data, dataLength, encodedDataLength);
}
-inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const NetworkLoadMetrics& networkLoadMetrics)
+inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const NetworkLoadMetrics& networkLoadMetrics, ResourceLoader* resourceLoader)
{
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
- didFinishLoadingImpl(*instrumentingAgents, identifier, loader, networkLoadMetrics);
+ didFinishLoadingImpl(*instrumentingAgents, identifier, loader, networkLoadMetrics, resourceLoader);
}
inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp (213916 => 213917)
--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2017-03-14 18:19:47 UTC (rev 213917)
@@ -419,13 +419,18 @@
m_frontendDispatcher->dataReceived(requestId, timestamp(), dataLength, encodedDataLength);
}
-void InspectorNetworkAgent::didFinishLoading(unsigned long identifier, DocumentLoader& loader, const NetworkLoadMetrics& networkLoadMetrics)
+void InspectorNetworkAgent::didFinishLoading(unsigned long identifier, DocumentLoader& loader, const NetworkLoadMetrics& networkLoadMetrics, ResourceLoader* resourceLoader)
{
if (m_hiddenRequestIdentifiers.remove(identifier))
return;
- // FIXME: We should use the NetworkLoadMetrics's responseEnd to match ResourceTiming.
- double elapsedFinishTime = timestamp();
+ double elapsedFinishTime;
+ if (resourceLoader && networkLoadMetrics.isComplete()) {
+ MonotonicTime startTime = resourceLoader->loadTiming().startTime();
+ double startTimeInInspector = m_environment.executionStopwatch()->elapsedTimeSince(startTime);
+ elapsedFinishTime = startTimeInInspector + networkLoadMetrics.responseEnd.seconds();
+ } else
+ elapsedFinishTime = timestamp();
String requestId = IdentifiersFactory::requestId(identifier);
if (m_resourcesData->resourceType(requestId) == InspectorPageAgent::DocumentResource)
Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.h (213916 => 213917)
--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.h 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.h 2017-03-14 18:19:47 UTC (rev 213917)
@@ -78,7 +78,7 @@
void willSendRequest(unsigned long identifier, DocumentLoader&, ResourceRequest&, const ResourceResponse& redirectResponse);
void didReceiveResponse(unsigned long identifier, DocumentLoader&, const ResourceResponse&, ResourceLoader*);
void didReceiveData(unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
- void didFinishLoading(unsigned long identifier, DocumentLoader&, const NetworkLoadMetrics&);
+ void didFinishLoading(unsigned long identifier, DocumentLoader&, const NetworkLoadMetrics&, ResourceLoader*);
void didFailLoading(unsigned long identifier, DocumentLoader&, const ResourceError&);
void didLoadResourceFromMemoryCache(DocumentLoader&, CachedResource&);
void didReceiveThreadableLoaderResponse(unsigned long identifier, DocumentThreadableLoader&);
Modified: trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp (213916 => 213917)
--- trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp 2017-03-14 18:19:47 UTC (rev 213917)
@@ -85,7 +85,7 @@
// for preflight failures and distinguish them better from non-preflight requests.
NetworkLoadMetrics emptyMetrics;
InspectorInstrumentation::didReceiveResourceResponse(*frame, identifier, frame->loader().documentLoader(), response, nullptr);
- InspectorInstrumentation::didFinishLoading(frame, frame->loader().documentLoader(), identifier, emptyMetrics);
+ InspectorInstrumentation::didFinishLoading(frame, frame->loader().documentLoader(), identifier, emptyMetrics, nullptr);
CrossOriginPreflightResultCache::singleton().appendEntry(loader.securityOrigin().toString(), request.url(), WTFMove(result));
loader.preflightSuccess(WTFMove(request));
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (213916 => 213917)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2017-03-14 18:19:47 UTC (rev 213917)
@@ -394,7 +394,7 @@
NetworkLoadMetrics emptyMetrics;
unsigned long identifier = m_identifierForLoadWithoutResourceLoader;
m_identifierForLoadWithoutResourceLoader = 0;
- frameLoader()->notifier().dispatchDidFinishLoading(this, identifier, emptyMetrics);
+ frameLoader()->notifier().dispatchDidFinishLoading(this, identifier, emptyMetrics, nullptr);
}
maybeFinishLoadingMultipartContent();
Modified: trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp (213916 => 213917)
--- trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp 2017-03-14 18:19:47 UTC (rev 213917)
@@ -92,7 +92,7 @@
if (Page* page = m_frame.page())
page->progress().completeProgress(loader->identifier());
- dispatchDidFinishLoading(loader->documentLoader(), loader->identifier(), networkLoadMetrics);
+ dispatchDidFinishLoading(loader->documentLoader(), loader->identifier(), networkLoadMetrics, loader);
}
void ResourceLoadNotifier::didFailToLoad(ResourceLoader* loader, const ResourceError& error)
@@ -153,13 +153,13 @@
InspectorInstrumentation::didReceiveData(&m_frame, identifier, data, dataLength, encodedDataLength);
}
-void ResourceLoadNotifier::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier, const NetworkLoadMetrics& networkLoadMetrics)
+void ResourceLoadNotifier::dispatchDidFinishLoading(DocumentLoader* loader, unsigned long identifier, const NetworkLoadMetrics& networkLoadMetrics, ResourceLoader* resourceLoader)
{
// Notifying the FrameLoaderClient may cause the frame to be destroyed.
Ref<Frame> protect(m_frame);
m_frame.loader().client().dispatchDidFinishLoading(loader, identifier);
- InspectorInstrumentation::didFinishLoading(&m_frame, loader, identifier, networkLoadMetrics);
+ InspectorInstrumentation::didFinishLoading(&m_frame, loader, identifier, networkLoadMetrics, resourceLoader);
}
void ResourceLoadNotifier::dispatchDidFailLoading(DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
@@ -189,7 +189,7 @@
if (error.isNull()) {
NetworkLoadMetrics emptyMetrics;
- dispatchDidFinishLoading(loader, identifier, emptyMetrics);
+ dispatchDidFinishLoading(loader, identifier, emptyMetrics, nullptr);
} else
dispatchDidFailLoading(loader, identifier, error);
}
Modified: trunk/Source/WebCore/loader/ResourceLoadNotifier.h (213916 => 213917)
--- trunk/Source/WebCore/loader/ResourceLoadNotifier.h 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/loader/ResourceLoadNotifier.h 2017-03-14 18:19:47 UTC (rev 213917)
@@ -60,7 +60,7 @@
void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, ResourceLoader* = nullptr);
void dispatchDidReceiveData(DocumentLoader*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
- void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier, const NetworkLoadMetrics&);
+ void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier, const NetworkLoadMetrics&, ResourceLoader*);
void dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&);
void sendRemainingDelegateMessages(DocumentLoader*, unsigned long identifier, const ResourceRequest&, const ResourceResponse&, const char* data, int dataLength, int encodedDataLength, const ResourceError&);
Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp (213916 => 213917)
--- trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp 2017-03-14 18:19:47 UTC (rev 213917)
@@ -575,7 +575,7 @@
{
// FIXME: We should have NetworkLoadMetrics for ApplicationCache loads.
NetworkLoadMetrics emptyMetrics;
- InspectorInstrumentation::didFinishLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, emptyMetrics);
+ InspectorInstrumentation::didFinishLoading(m_frame, m_frame->loader().documentLoader(), m_currentResourceIdentifier, emptyMetrics, nullptr);
if (handle == m_manifestHandle) {
didFinishLoadingManifest();
Modified: trunk/Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm (213916 => 213917)
--- trunk/Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebCore/platform/network/cocoa/NetworkLoadMetrics.mm 2017-03-14 18:19:47 UTC (rev 213917)
@@ -41,11 +41,11 @@
{
if (!timingData)
return;
-
+
// This is not the navigationStart time in monotonic time, but the other times are relative to this time
// and only the differences between times are stored.
double referenceStart = timingValue(timingData, @"_kCFNTimingDataFetchStart");
-
+
double domainLookupStart = timingValue(timingData, @"_kCFNTimingDataDomainLookupStart");
double domainLookupEnd = timingValue(timingData, @"_kCFNTimingDataDomainLookupEnd");
double connectStart = timingValue(timingData, @"_kCFNTimingDataConnectStart");
@@ -53,15 +53,15 @@
double connectEnd = timingValue(timingData, @"_kCFNTimingDataConnectEnd");
double requestStart = timingValue(timingData, @"_kCFNTimingDataRequestStart");
double responseStart = timingValue(timingData, @"_kCFNTimingDataResponseStart");
-
- timing.domainLookupStart = Seconds(domainLookupStart <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(domainLookupStart - referenceStart));
- timing.domainLookupEnd = Seconds(domainLookupEnd <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(domainLookupEnd - referenceStart));
- timing.connectStart = Seconds(connectStart <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(connectStart - referenceStart));
- timing.secureConnectionStart = Seconds(secureConnectionStart <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(secureConnectionStart - referenceStart));
- timing.connectEnd = Seconds(connectEnd <= 0 ? Seconds(-1) : Seconds::fromMilliseconds(connectEnd - referenceStart));
- timing.requestStart = Seconds(requestStart <= 0 ? Seconds(0) : Seconds::fromMilliseconds(requestStart - referenceStart));
- timing.responseStart = Seconds(responseStart <= 0 ? Seconds(0) : Seconds::fromMilliseconds(responseStart - referenceStart));
+ timing.domainLookupStart = Seconds(domainLookupStart <= 0 ? -1 : domainLookupStart - referenceStart);
+ timing.domainLookupEnd = Seconds(domainLookupEnd <= 0 ? -1 : domainLookupEnd - referenceStart);
+ timing.connectStart = Seconds(connectStart <= 0 ? -1 : connectStart - referenceStart);
+ timing.secureConnectionStart = Seconds(secureConnectionStart <= 0 ? -1 : secureConnectionStart - referenceStart);
+ timing.connectEnd = Seconds(connectEnd <= 0 ? -1 : connectEnd - referenceStart);
+ timing.requestStart = Seconds(requestStart <= 0 ? 0 : requestStart - referenceStart);
+ timing.responseStart = Seconds(responseStart <= 0 ? 0 : responseStart - referenceStart);
+
// NOTE: responseEnd is not populated in this code path.
}
Modified: trunk/Source/WebInspectorUI/ChangeLog (213916 => 213917)
--- trunk/Source/WebInspectorUI/ChangeLog 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebInspectorUI/ChangeLog 2017-03-14 18:19:47 UTC (rev 213917)
@@ -1,3 +1,19 @@
+2017-03-14 Joseph Pecoraro <pecor...@apple.com>
+
+ Web Inspector: More accurate Resource Timing data in Web Inspector
+ https://bugs.webkit.org/show_bug.cgi?id=169577
+
+ Reviewed by Youenn Fablet.
+
+ * UserInterface/Models/ResourceTimingData.js:
+ (WebInspector.ResourceTimingData.prototype.get requestStart):
+ (WebInspector.ResourceTimingData.prototype.get responseStart):
+ Fallback to the startTime if available instead of using the
+ inaccurate WebContentProcess gathered timestamps.
+
+ (WebInspector.ResourceTimingData.prototype.markResponseEndTime):
+ Verify responseEnd compared to other times we may have.
+
2017-03-14 Devin Rousso <web...@devinrousso.com>
Web Inspector: Remove unnecessary assert for Number.percentageString
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js (213916 => 213917)
--- trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js 2017-03-14 17:58:09 UTC (rev 213916)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js 2017-03-14 18:19:47 UTC (rev 213917)
@@ -65,7 +65,7 @@
payload = {};
function offsetToTimestamp(offset) {
- return offset > 0 ? payload.startTime + offset / 1000 : NaN;
+ return offset > 0 ? payload.startTime + (offset / 1000) : NaN;
}
let data = {
@@ -95,13 +95,15 @@
get connectStart() { return this._connectStart; }
get connectEnd() { return this._connectEnd; }
get secureConnectionStart() { return this._secureConnectionStart; }
- get requestStart() { return this._requestStart || this._resource.requestSentTimestamp; }
- get responseStart() { return this._responseStart || this._resource.responseReceivedTimestamp; }
+ get requestStart() { return this._requestStart || this._startTime || this._resource.requestSentTimestamp; }
+ get responseStart() { return this._responseStart || this._startTime || this._resource.responseReceivedTimestamp; }
get responseEnd() { return this._responseEnd || this._resource.finishedOrFailedTimestamp; }
markResponseEndTime(responseEnd)
{
console.assert(typeof responseEnd === "number");
+ console.assert(isNaN(responseEnd) || responseEnd >= this.startTime, "responseEnd time should be greater than the start time", this.startTime, responseEnd);
+ console.assert(isNaN(responseEnd) || responseEnd >= this.requestStart, "responseEnd time should be greater than the request time", this.requestStart, responseEnd);
this._responseEnd = responseEnd;
}
};