Bug 161314

Summary: Web Inspector: Add resource timing model with timing information
Product: WebKit Reporter: Johan K. Jensen <jj>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, buildbot, commit-queue, joepeck, mattbaker, nvasilyev, rniwa, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews102 for mac-yosemite
none
Archive of layout-test-results from ews105 for mac-yosemite-wk2
none
Archive of layout-test-results from ews116 for mac-yosemite
none
Patch for bots
none
Archive of layout-test-results from ews103 for mac-yosemite
none
Archive of layout-test-results from ews105 for mac-yosemite-wk2
none
Archive of layout-test-results from ews117 for mac-yosemite
none
Patch
none
Patch none

Description Johan K. Jensen 2016-08-29 09:46:34 PDT
Add a resource timing model to keep track of timing information used by e.g. timing details/waterfall in the network tab.
Comment 1 Radar WebKit Bug Importer 2016-08-29 09:47:09 PDT
<rdar://problem/28056977>
Comment 2 Johan K. Jensen 2016-08-29 10:41:46 PDT
Created attachment 287280 [details]
Patch
Comment 3 Build Bot 2016-08-29 11:32:13 PDT
Comment on attachment 287280 [details]
Patch

Attachment 287280 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1966762

New failing tests:
http/tests/inspector/network/resource-timing.html
Comment 4 Build Bot 2016-08-29 11:32:22 PDT
Created attachment 287289 [details]
Archive of layout-test-results from ews102 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 5 Joseph Pecoraro 2016-08-29 11:33:39 PDT
Comment on attachment 287280 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287280&action=review

r=me, though please double check with earlier iOS devices to make sure things still work there.

> Source/WebInspectorUI/ChangeLog:31
> +        Update timing object with info on from response.

Typo: "on from response"

> Source/WebInspectorUI/UserInterface/Main.html:355
> +    <script src="Models/ResourceTimingData.js"></script>

Style: Alphabetical order. Even though "Resource" uses "ResourceTimingData" the order is fine because neither are actually used until after all scripts have loaded.

> Source/WebInspectorUI/UserInterface/Models/Resource.js:475
>          this._responseHeadersSize = String(this._statusCode).length + this._statusText.length + 12; // Extra length is for "HTTP/1.1 ", " ", and "\r\n".

Gosh, just noticed this wouldn't work for HTTP/2. Nothing you need to change.

> Source/WebInspectorUI/UserInterface/Models/Resource.js:579
> +        this._timingData._responseEnd = elapsedTime || NaN;

Setting a private member like this is sketchy. Normally we would create some public method on ResourceTimingData and call here it. Something like:

    markResponseEndTime(responseEnd)

> Source/WebInspectorUI/UserInterface/Models/ResourceTimelineRecord.js:55
> -        return this._resource.requestSentTimestamp;
> +        return this._resource.timingData.startTime;

Same thing here.

> Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js:68
> +    // Static

Style: Static methods, like this, normally go above the Public block.

> LayoutTests/http/tests/inspector/network/resource-timing.html:11
> +function resolve(url) {
> +    let a = document.createElement('a');
> +    a.href = url;
> +    return a.href;
> +}

This function doesn't appear to be used. Drop it?

> LayoutTests/http/tests/inspector/network/resource-timing.html:13
> +function createRequest()
> +{

Nit: My style in tests would be to put this brace on the same line as the function name because it is outside of the test() function. But I may be the only one that uses this style.

> LayoutTests/http/tests/inspector/network/resource-timing.html:21
> +    let suite = InspectorTest.createAsyncSuite("ResourceTiming");

Lets name this after the model object "ResourceTimingData".
Comment 6 Build Bot 2016-08-29 11:34:50 PDT
Comment on attachment 287280 [details]
Patch

Attachment 287280 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1966767

New failing tests:
http/tests/inspector/network/resource-timing.html
Comment 7 Build Bot 2016-08-29 11:35:00 PDT
Created attachment 287290 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 8 Joseph Pecoraro 2016-08-29 11:42:26 PDT
Hmm, the test failed on the Mac Yosemite bots:

--- /Volumes/Data/EWS/WebKit/WebKitBuild/Release/layout-test-results/http/tests/inspector/network/resource-timing-expected.txt
+++ /Volumes/Data/EWS/WebKit/WebKitBuild/Release/layout-test-results/http/tests/inspector/network/resource-timing-actual.txt
@@ -12,7 +12,7 @@
 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.
+FAIL: 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.

That is weird.
Comment 9 Build Bot 2016-08-29 11:47:18 PDT
Comment on attachment 287280 [details]
Patch

Attachment 287280 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1966764

New failing tests:
http/tests/inspector/network/resource-timing.html
Comment 10 Build Bot 2016-08-29 11:47:23 PDT
Created attachment 287296 [details]
Archive of layout-test-results from ews116 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews116  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 11 Johan K. Jensen 2016-08-29 13:11:16 PDT
Created attachment 287309 [details]
Patch for bots
Comment 12 Build Bot 2016-08-29 13:41:57 PDT
Comment on attachment 287309 [details]
Patch for bots

Attachment 287309 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/1967417

New failing tests:
http/tests/inspector/network/resource-timing.html
Comment 13 Build Bot 2016-08-29 13:42:03 PDT
Created attachment 287316 [details]
Archive of layout-test-results from ews103 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 14 Build Bot 2016-08-29 14:03:45 PDT
Comment on attachment 287309 [details]
Patch for bots

Attachment 287309 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/1967488

New failing tests:
http/tests/inspector/network/resource-timing.html
Comment 15 Build Bot 2016-08-29 14:03:51 PDT
Created attachment 287318 [details]
Archive of layout-test-results from ews105 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 16 Build Bot 2016-08-29 14:08:26 PDT
Comment on attachment 287309 [details]
Patch for bots

Attachment 287309 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/1967487

New failing tests:
http/tests/inspector/network/resource-timing.html
Comment 17 Build Bot 2016-08-29 14:08:31 PDT
Created attachment 287321 [details]
Archive of layout-test-results from ews117 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews117  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 18 Johan K. Jensen 2016-08-29 15:03:26 PDT
Created attachment 287334 [details]
Patch
Comment 19 Joseph Pecoraro 2016-08-30 12:31:34 PDT
Comment on attachment 287334 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=287334&action=review

> Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js:85
> +        if (isNaN(data.connectStart) && !isNaN(data.secureConnectionStart))
> +            data.connectStart = data.domainLookupEnd ? data.domainLookupEnd : data.startTime;

Maybe this should just be data.connectStart = data.secureConnectionStart? And we don't get to distinguish between connectStart/secureConnectionStart. I don't like the idea of using one of the previous timestamps.

Would that cause problems?
Comment 20 Johan K. Jensen 2016-08-30 16:39:31 PDT
Created attachment 287450 [details]
Patch
Comment 21 Joseph Pecoraro 2016-08-30 17:08:02 PDT
Comment on attachment 287450 [details]
Patch

r=me!
Comment 22 WebKit Commit Bot 2016-08-30 17:29:19 PDT
Comment on attachment 287450 [details]
Patch

Clearing flags on attachment: 287450

Committed r205211: <http://trac.webkit.org/changeset/205211>
Comment 23 WebKit Commit Bot 2016-08-30 17:29:26 PDT
All reviewed patches have been landed.  Closing bug.