<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[205211] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/205211">205211</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-30 17:27:27 -0700 (Tue, 30 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Add resource timing model with timing information
https://bugs.webkit.org/show_bug.cgi?id=161314
Patch by Johan K. Jensen <johan_jensen@apple.com> on 2016-08-30
Reviewed by Joseph Pecoraro.
Source/WebInspectorUI:
Add a resource timing data model and populate it with info from the
response from the backend.
* UserInterface/Controllers/FrameResourceManager.js:
(WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache):
(WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse):
Forward timing data from response to Resource.js.
* UserInterface/Main.html: Add new ResourceTimingData.js.
* UserInterface/Test.html: Add new ResourceTimingData.js.
* UserInterface/Models/Resource.js:
(WebInspector.Resource): Instantiate ResourceTimingData object.
(WebInspector.Resource.prototype.get timing):
(WebInspector.Resource.prototype.get firstTimestamp):
(WebInspector.Resource.prototype.get lastTimestamp):
(WebInspector.Resource.prototype.get duration):
(WebInspector.Resource.prototype.get latency):
(WebInspector.Resource.prototype.get receiveDuration):
Update getters to use new timing model.
(WebInspector.Resource.prototype.updateForResponse):
Update timing object with info from response.
(WebInspector.Resource.prototype.markAsFinished):
Log response end time.
* UserInterface/Models/ResourceTimelineRecord.js:
(WebInspector.ResourceTimelineRecord.prototype.get startTime):
(WebInspector.ResourceTimelineRecord.prototype.get activeStartTime):
(WebInspector.ResourceTimelineRecord.prototype.get endTime):
Update getters to use new timing model.
* UserInterface/Models/ResourceTimingData.js: Added.
(WebInspector.ResourceTimingData):
(WebInspector.ResourceTimingData.fromPayload):
(WebInspector.ResourceTimingData.prototype.get startTime):
(WebInspector.ResourceTimingData.prototype.get domainLookupStart):
(WebInspector.ResourceTimingData.prototype.get domainLookupEnd):
(WebInspector.ResourceTimingData.prototype.get connectStart):
(WebInspector.ResourceTimingData.prototype.get connectEnd):
(WebInspector.ResourceTimingData.prototype.get secureConnectionStart):
(WebInspector.ResourceTimingData.prototype.get requestStart):
(WebInspector.ResourceTimingData.prototype.get responseStart):
(WebInspector.ResourceTimingData.prototype.get responseEnd):
(WebInspector.ResourceTimingData.prototype.markResponseEndTime):
Add new ResourceTimingData model and fall back on old timestamps
for when data is unavailable.
LayoutTests:
Add tests for the Resource Timing Data model.
* http/tests/inspector/network/resource-timing-expected.txt: Added.
* http/tests/inspector/network/resource-timing.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersFrameResourceManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsResourcejs">trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsResourceTimelineRecordjs">trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTesthtml">trunk/Source/WebInspectorUI/UserInterface/Test.html</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourcetimingexpectedtxt">trunk/LayoutTests/http/tests/inspector/network/resource-timing-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsinspectornetworkresourcetiminghtml">trunk/LayoutTests/http/tests/inspector/network/resource-timing.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsResourceTimingDatajs">trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (205210 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-31 00:15:50 UTC (rev 205210)
+++ trunk/LayoutTests/ChangeLog        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-08-30 Johan K. Jensen <johan_jensen@apple.com>
+
+ Web Inspector: Add resource timing model with timing information
+ https://bugs.webkit.org/show_bug.cgi?id=161314
+
+ Reviewed by Joseph Pecoraro.
+
+ Add tests for the Resource Timing Data model.
+
+ * http/tests/inspector/network/resource-timing-expected.txt: Added.
+ * http/tests/inspector/network/resource-timing.html: Added.
+
</ins><span class="cx"> 2016-08-30 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Object.setPrototypeOf() should throw when used on a cross-origin Window / Location object
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourcetimingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resource-timing-expected.txt (0 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-timing-expected.txt         (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-timing-expected.txt        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+Tests that a resource has timing information.
+
+
+== Running test suite: ResourceTimingData
+-- Running test case: CheckResourceTimingInformationForResource
+PASS: Newly added resource should have a resource timing model.
+PASS: Newly added resource should have a start time.
+PASS: Resource should now contain timing information.
+PASS: Resource should have a start time.
+PASS: Resource should have a request start time.
+PASS: Resource should have a response start time.
+PASS: domainLookupStart and domainLookupEnd should both be NaN or a number.
+PASS: connectStart and connectEnd should both be NaN or a number.
+PASS: requestStart should come after startTime.
+PASS: A secure connection should be reused or secureConnectionStart should come after connectStart.
+PASS: responseStart should come after requestStart.
+PASS: responseEnd should not be available yet.
+PASS: responseEnd should come after responseStart.
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsinspectornetworkresourcetiminghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/inspector/network/resource-timing.html (0 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/inspector/network/resource-timing.html         (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-timing.html        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../resources/inspector-test.js"></script>
+<script>
+function createRequest() {
+ let img = document.createElement("img");
+ img.src = "https://localhost:8443/resources/square100.png";
+ document.body.appendChild(img);
+}
+
+function test() {
+ let suite = InspectorTest.createAsyncSuite("ResourceTimingData");
+ InspectorTest.debug();
+ suite.addTestCase({
+ name: "CheckResourceTimingInformationForResource",
+ description: "Check if a resource has timing information.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createRequest()");
+ WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+ let resource = event.data.resource;
+
+ InspectorTest.expectThat(resource.timingData instanceof WebInspector.ResourceTimingData, "Newly added resource should have a resource timing model.");
+ InspectorTest.expectThat(resource.timingData.startTime, "Newly added resource should have a start time.");
+
+ resource.singleFireEventListener(WebInspector.Resource.Event.ResponseReceived, (event) => {
+ let timingData = resource.timingData;
+
+ InspectorTest.expectThat(timingData, "Resource should now contain timing information.");
+ InspectorTest.expectThat(timingData.startTime > 0, "Resource should have a start time.");
+ InspectorTest.expectThat(timingData.requestStart > 0, "Resource should have a request start time.");
+ InspectorTest.expectThat(timingData.responseStart > 0, "Resource should have a response start time.");
+
+ InspectorTest.expectThat(typeof timingData.domainLookupStart === "number" && typeof timingData.domainLookupEnd === "number", "domainLookupStart and domainLookupEnd should both be NaN or a number.");
+ InspectorTest.expectThat(typeof timingData.connectStart === "number" && typeof timingData.connectStart === "number", "connectStart and connectEnd should both be NaN or a number.");
+
+ InspectorTest.expectThat(timingData.startTime <= timingData.requestStart, "requestStart should come after startTime.");
+ InspectorTest.expectThat(isNaN(timingData.secureConnectionStart) || timingData.connectStart <= timingData.secureConnectionStart, "A secure connection should be reused or secureConnectionStart should come after connectStart.");
+ InspectorTest.expectThat(timingData.requestStart <= timingData.responseStart, "responseStart should come after requestStart.");
+ InspectorTest.expectThat(isNaN(timingData.responseEnd), "responseEnd should not be available yet.");
+ });
+
+ resource.singleFireEventListener(WebInspector.Resource.Event.LoadingDidFinish, (event) => {
+ let timingData = resource.timingData;
+ InspectorTest.expectThat(timingData.responseStart <= timingData.responseEnd, "responseEnd should come after responseStart.");
+ resolve();
+ });
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+ <p>Tests that a resource has timing information.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (205210 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-08-31 00:15:50 UTC (rev 205210)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -1,3 +1,60 @@
</span><ins>+2016-08-30 Johan K. Jensen <johan_jensen@apple.com>
+
+ Web Inspector: Add resource timing model with timing information
+ https://bugs.webkit.org/show_bug.cgi?id=161314
+
+ Reviewed by Joseph Pecoraro.
+
+ Add a resource timing data model and populate it with info from the
+ response from the backend.
+
+ * UserInterface/Controllers/FrameResourceManager.js:
+ (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache):
+ (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse):
+ Forward timing data from response to Resource.js.
+
+ * UserInterface/Main.html: Add new ResourceTimingData.js.
+ * UserInterface/Test.html: Add new ResourceTimingData.js.
+
+ * UserInterface/Models/Resource.js:
+ (WebInspector.Resource): Instantiate ResourceTimingData object.
+
+ (WebInspector.Resource.prototype.get timing):
+ (WebInspector.Resource.prototype.get firstTimestamp):
+ (WebInspector.Resource.prototype.get lastTimestamp):
+ (WebInspector.Resource.prototype.get duration):
+ (WebInspector.Resource.prototype.get latency):
+ (WebInspector.Resource.prototype.get receiveDuration):
+ Update getters to use new timing model.
+
+ (WebInspector.Resource.prototype.updateForResponse):
+ Update timing object with info from response.
+
+ (WebInspector.Resource.prototype.markAsFinished):
+ Log response end time.
+
+ * UserInterface/Models/ResourceTimelineRecord.js:
+ (WebInspector.ResourceTimelineRecord.prototype.get startTime):
+ (WebInspector.ResourceTimelineRecord.prototype.get activeStartTime):
+ (WebInspector.ResourceTimelineRecord.prototype.get endTime):
+ Update getters to use new timing model.
+
+ * UserInterface/Models/ResourceTimingData.js: Added.
+ (WebInspector.ResourceTimingData):
+ (WebInspector.ResourceTimingData.fromPayload):
+ (WebInspector.ResourceTimingData.prototype.get startTime):
+ (WebInspector.ResourceTimingData.prototype.get domainLookupStart):
+ (WebInspector.ResourceTimingData.prototype.get domainLookupEnd):
+ (WebInspector.ResourceTimingData.prototype.get connectStart):
+ (WebInspector.ResourceTimingData.prototype.get connectEnd):
+ (WebInspector.ResourceTimingData.prototype.get secureConnectionStart):
+ (WebInspector.ResourceTimingData.prototype.get requestStart):
+ (WebInspector.ResourceTimingData.prototype.get responseStart):
+ (WebInspector.ResourceTimingData.prototype.get responseEnd):
+ (WebInspector.ResourceTimingData.prototype.markResponseEndTime):
+ Add new ResourceTimingData model and fall back on old timestamps
+ for when data is unavailable.
+
</ins><span class="cx"> 2016-08-30 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Fix WebInspectorUI in internal Windows build
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersFrameResourceManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js (205210 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js        2016-08-31 00:15:50 UTC (rev 205210)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx"> var response = cachedResourcePayload.response;
</span><span class="cx"> var resource = this._addNewResourceToFrame(requestIdentifier, frameIdentifier, loaderIdentifier, cachedResourcePayload.url, cachedResourcePayload.type, "GET", null, null, elapsedTime, null, null, initiatorSourceCodeLocation);
</span><span class="cx"> resource.markAsCached();
</span><del>- resource.updateForResponse(cachedResourcePayload.url, response.mimeType, cachedResourcePayload.type, response.headers, response.status, response.statusText, elapsedTime);
</del><ins>+ resource.updateForResponse(cachedResourcePayload.url, response.mimeType, cachedResourcePayload.type, response.headers, response.status, response.statusText, elapsedTime, response.timing);
</ins><span class="cx"> resource.increaseSize(cachedResourcePayload.bodySize, elapsedTime);
</span><span class="cx"> resource.increaseTransferSize(cachedResourcePayload.bodySize);
</span><span class="cx"> resource.markAsFinished(elapsedTime);
</span><span class="lines">@@ -288,7 +288,7 @@
</span><span class="cx"> if (response.fromDiskCache)
</span><span class="cx"> resource.markAsCached();
</span><span class="cx">
</span><del>- resource.updateForResponse(response.url, response.mimeType, type, response.headers, response.status, response.statusText, elapsedTime);
</del><ins>+ resource.updateForResponse(response.url, response.mimeType, type, response.headers, response.status, response.statusText, elapsedTime, response.timing);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> resourceRequestDidReceiveData(requestIdentifier, dataLength, encodedDataLength, timestamp)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (205210 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2016-08-31 00:15:50 UTC (rev 205210)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -357,6 +357,7 @@
</span><span class="cx"> <script src="Models/ResourceQueryMatch.js"></script>
</span><span class="cx"> <script src="Models/ResourceQueryResult.js"></script>
</span><span class="cx"> <script src="Models/ResourceTimelineRecord.js"></script>
</span><ins>+ <script src="Models/ResourceTimingData.js"></script>
</ins><span class="cx"> <script src="Models/Revision.js"></script>
</span><span class="cx"> <script src="Models/ScopeChainNode.js"></script>
</span><span class="cx"> <script src="Models/Script.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsResourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (205210 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js        2016-08-31 00:15:50 UTC (rev 205210)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx"> this._size = NaN;
</span><span class="cx"> this._transferSize = NaN;
</span><span class="cx"> this._cached = false;
</span><ins>+ this._timingData = new WebInspector.ResourceTimingData(this);
</ins><span class="cx">
</span><span class="cx"> if (this._initiatorSourceCodeLocation && this._initiatorSourceCodeLocation.sourceCode instanceof WebInspector.Resource)
</span><span class="cx"> this._initiatorSourceCodeLocation.sourceCode.addInitiatedResource(this);
</span><span class="lines">@@ -126,6 +127,8 @@
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><ins>+ get timingData() { return this._timingData; }
+
</ins><span class="cx"> get url()
</span><span class="cx"> {
</span><span class="cx"> return this._url;
</span><span class="lines">@@ -317,27 +320,27 @@
</span><span class="cx">
</span><span class="cx"> get firstTimestamp()
</span><span class="cx"> {
</span><del>- return this.requestSentTimestamp || this.lastRedirectReceivedTimestamp || this.responseReceivedTimestamp || this.lastDataReceivedTimestamp || this.finishedOrFailedTimestamp;
</del><ins>+ return this.timingData.startTime || this.lastRedirectReceivedTimestamp || this.responseReceivedTimestamp || this.lastDataReceivedTimestamp || this.finishedOrFailedTimestamp;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get lastTimestamp()
</span><span class="cx"> {
</span><del>- return this.finishedOrFailedTimestamp || this.lastDataReceivedTimestamp || this.responseReceivedTimestamp || this.lastRedirectReceivedTimestamp || this.requestSentTimestamp;
</del><ins>+ return this.timingData.responseEnd || this.lastDataReceivedTimestamp || this.responseReceivedTimestamp || this.lastRedirectReceivedTimestamp || this.requestSentTimestamp;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get duration()
</span><span class="cx"> {
</span><del>- return this._finishedOrFailedTimestamp - this._requestSentTimestamp;
</del><ins>+ return this.timingData.responseEnd - this.timingData.requestStart;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get latency()
</span><span class="cx"> {
</span><del>- return this._responseReceivedTimestamp - this._requestSentTimestamp;
</del><ins>+ return this.timingData.responseStart - this.timingData.requestStart;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get receiveDuration()
</span><span class="cx"> {
</span><del>- return this._finishedOrFailedTimestamp - this._responseReceivedTimestamp;
</del><ins>+ return this.timingData.responseEnd - this.timingData.responseStart;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get cached()
</span><span class="lines">@@ -447,7 +450,7 @@
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateForResponse(url, mimeType, type, responseHeaders, statusCode, statusText, elapsedTime)
</del><ins>+ updateForResponse(url, mimeType, type, responseHeaders, statusCode, statusText, elapsedTime, timingData)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(!this._finished);
</span><span class="cx"> console.assert(!this._failed);
</span><span class="lines">@@ -467,6 +470,7 @@
</span><span class="cx"> this._statusText = statusText;
</span><span class="cx"> this._responseHeaders = responseHeaders || {};
</span><span class="cx"> this._responseReceivedTimestamp = elapsedTime || NaN;
</span><ins>+ this._timingData = WebInspector.ResourceTimingData.fromPayload(timingData, this);
</ins><span class="cx">
</span><span class="cx"> this._responseHeadersSize = String(this._statusCode).length + this._statusText.length + 12; // Extra length is for "HTTP/1.1 ", " ", and "\r\n".
</span><span class="cx"> for (var name in this._responseHeaders)
</span><span class="lines">@@ -572,6 +576,7 @@
</span><span class="cx">
</span><span class="cx"> this._finished = true;
</span><span class="cx"> this._finishedOrFailedTimestamp = elapsedTime || NaN;
</span><ins>+ this._timingData.markResponseEndTime(elapsedTime || NaN);
</ins><span class="cx">
</span><span class="cx"> if (this._finishThenRequestContentPromise)
</span><span class="cx"> this._finishThenRequestContentPromise = null;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsResourceTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js (205210 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js        2016-08-31 00:15:50 UTC (rev 205210)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -52,17 +52,17 @@
</span><span class="cx">
</span><span class="cx"> get startTime()
</span><span class="cx"> {
</span><del>- return this._resource.requestSentTimestamp;
</del><ins>+ return this._resource.timingData.startTime;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get activeStartTime()
</span><span class="cx"> {
</span><del>- return this._resource.responseReceivedTimestamp;
</del><ins>+ return this._resource.timingData.responseStart;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get endTime()
</span><span class="cx"> {
</span><del>- return this._resource.finishedOrFailedTimestamp;
</del><ins>+ return this._resource.timingData.responseEnd;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Private
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsResourceTimingDatajs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js (0 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -0,0 +1,107 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.ResourceTimingData = class ResourceTimingData extends WebInspector.Object
+{
+ constructor(resource, data)
+ {
+ super();
+
+ data = data || {};
+
+ console.assert(isNaN(data.domainLookupStart) === isNaN(data.domainLookupEnd));
+ console.assert(isNaN(data.connectStart) === isNaN(data.connectEnd));
+
+ this._resource = resource;
+
+ this._startTime = data.startTime || NaN;
+ this._domainLookupStart = data.domainLookupStart || NaN;
+ this._domainLookupEnd = data.domainLookupEnd || NaN;
+ this._connectStart = data.connectStart || NaN;
+ this._connectEnd = data.connectEnd || NaN;
+ this._secureConnectionStart = data.secureConnectionStart || NaN;
+ this._requestStart = data.requestStart || NaN;
+ this._responseStart = data.responseStart || NaN;
+ this._responseEnd = data.responseEnd || NaN;
+
+ if (this._domainLookupStart >= this._domainLookupEnd)
+ this._domainLookupStart = this._domainLookupEnd = NaN;
+
+ if (this._connectStart >= this._connectEnd)
+ this._connectStart = this._connectEnd = NaN;
+ }
+
+ // Static
+
+ static fromPayload(payload, resource)
+ {
+ payload = payload || {};
+
+ // COMPATIBILITY (iOS 10): Resource Timing data was incomplete and incorrect. Do not use it.
+ // iOS 7 sent a requestTime and iOS 8-9.3 sent a navigationStart time.
+ if (typeof payload.requestTime === "number" || typeof payload.navigationStart === "number")
+ payload = {};
+
+ function offsetToTimestamp(offset) {
+ return offset > 0 ? payload.startTime + offset / 1000 : NaN;
+ }
+
+ let data = {
+ startTime: payload.startTime,
+ domainLookupStart: offsetToTimestamp(payload.domainLookupStart),
+ domainLookupEnd: offsetToTimestamp(payload.domainLookupEnd),
+ connectStart: offsetToTimestamp(payload.connectStart),
+ connectEnd: offsetToTimestamp(payload.connectEnd),
+ secureConnectionStart: offsetToTimestamp(payload.secureConnectionStart),
+ requestStart: offsetToTimestamp(payload.requestStart),
+ responseStart: offsetToTimestamp(payload.responseStart),
+ responseEnd: offsetToTimestamp(payload.responseEnd)
+ };
+
+ // COMPATIBILITY (iOS 8): connectStart is zero if a secure connection is used.
+ if (isNaN(data.connectStart) && !isNaN(data.secureConnectionStart))
+ data.connectStart = data.secureConnectionStart;
+
+ return new WebInspector.ResourceTimingData(resource, data);
+ }
+
+ // Public
+
+ get startTime() { return this._startTime || this._resource.requestSentTimestamp; }
+ get domainLookupStart() { return this._domainLookupStart; }
+ get domainLookupEnd() { return this._domainLookupEnd; }
+ 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 responseEnd() { return this._responseEnd || this._resource.finishedOrFailedTimestamp; }
+
+ markResponseEndTime(responseEnd)
+ {
+ console.assert(typeof responseEnd === "number");
+ this._responseEnd = responseEnd;
+ }
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTesthtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test.html (205210 => 205211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test.html        2016-08-31 00:15:50 UTC (rev 205210)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html        2016-08-31 00:27:27 UTC (rev 205211)
</span><span class="lines">@@ -147,6 +147,7 @@
</span><span class="cx"> <script src="Models/ResourceQueryMatch.js"></script>
</span><span class="cx"> <script src="Models/ResourceQueryResult.js"></script>
</span><span class="cx"> <script src="Models/ResourceTimelineRecord.js"></script>
</span><ins>+ <script src="Models/ResourceTimingData.js"></script>
</ins><span class="cx"> <script src="Models/Revision.js"></script>
</span><span class="cx"> <script src="Models/ScopeChainNode.js"></script>
</span><span class="cx"> <script src="Models/Script.js"></script>
</span></span></pre>
</div>
</div>
</body>
</html>