Diff
Modified: trunk/LayoutTests/ChangeLog (137771 => 137772)
--- trunk/LayoutTests/ChangeLog 2012-12-14 22:18:23 UTC (rev 137771)
+++ trunk/LayoutTests/ChangeLog 2012-12-14 22:30:20 UTC (rev 137772)
@@ -1,3 +1,13 @@
+2012-12-14 James Simonsen <[email protected]>
+
+ [Resource Timing] Properly report reused connections
+ https://bugs.webkit.org/show_bug.cgi?id=104986
+
+ Reviewed by Tony Gentilcore.
+
+ * http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse-expected.txt: Added.
+ * http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse.html: Added.
+
2012-12-14 Adam Klein <[email protected]>
fast/dom/HTMLTemplateElement/inertContents.html is flaky
Added: trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse-expected.txt (0 => 137772)
--- trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse-expected.txt 2012-12-14 22:30:20 UTC (rev 137772)
@@ -0,0 +1,9 @@
+Description
+
+This test validates that connectStart and connectEnd are the same when a connection is reused.
+
+
+
+PASS There should be 2 PerformanceEntries
+PASS connectStart and connectEnd should be the same
+
Added: trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse.html (0 => 137772)
--- trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse.html (rev 0)
+++ trunk/LayoutTests/http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse.html 2012-12-14 22:30:20 UTC (rev 137772)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>Resource Timing connection reuse</title>
+<link rel="author" title="Google" href="" />
+<link rel="help" href=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+setup({explicit_done: true});
+var iframe;
+var d;
+var body;
+
+function setup_iframe() {
+ iframe = document.getElementById('frameContext');
+ d = iframe.contentWindow.document;
+ body = d.createElement('body');
+ d.getElementsByTagName('html')[0].appendChild(body);
+
+ var image = d.createElement('img');
+ image.src = '';
+ image.addEventListener('load', first_image_loaded);
+ body.appendChild(image);
+}
+
+function first_image_loaded() {
+ var image = d.createElement('img');
+ image.src = '';
+ image.addEventListener('load', second_image_loaded);
+ body.appendChild(image);
+}
+
+function second_image_loaded() {
+ var entries = iframe.contentWindow.performance.webkitGetEntries();
+ test_equals(entries.length, 2, 'There should be 2 PerformanceEntries');
+
+ var entry = entries[0];
+ test_equals(entry.connectStart, entry.connectEnd, "connectStart and connectEnd should be the same");
+
+ done();
+}
+
+window.setup_iframe = setup_iframe;
+</script>
+</head>
+<body>
+<h1>Description</h1>
+<p>This test validates that connectStart and connectEnd are the same when a connection is reused.</p>
+<div id="log"></div>
+<iframe id="frameContext" src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (137771 => 137772)
--- trunk/Source/WebCore/ChangeLog 2012-12-14 22:18:23 UTC (rev 137771)
+++ trunk/Source/WebCore/ChangeLog 2012-12-14 22:30:20 UTC (rev 137772)
@@ -1,3 +1,19 @@
+2012-12-14 James Simonsen <[email protected]>
+
+ [Resource Timing] Properly report reused connections
+ https://bugs.webkit.org/show_bug.cgi?id=104986
+
+ Reviewed by Tony Gentilcore.
+
+ Test: http/tests/w3c/webperf/submission/resource-timing/html/test_resource_connection_reuse.html
+
+ * page/PerformanceResourceTiming.cpp:
+ (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
+ (WebCore::PerformanceResourceTiming::connectStart):
+ (WebCore::PerformanceResourceTiming::connectEnd):
+ * page/PerformanceResourceTiming.h:
+ (PerformanceResourceTiming):
+
2012-12-14 Roger Fong <[email protected]>
Enable video caption controls on Windows.
Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.cpp (137771 => 137772)
--- trunk/Source/WebCore/page/PerformanceResourceTiming.cpp 2012-12-14 22:18:23 UTC (rev 137771)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.cpp 2012-12-14 22:30:20 UTC (rev 137772)
@@ -81,6 +81,7 @@
, m_initiatorType(initiatorType)
, m_timing(response.resourceLoadTiming())
, m_finishTime(finishTime)
+ , m_didReuseConnection(response.connectionReused())
, m_shouldReportDetails(passesTimingAllowCheck(response, requestingDocument))
, m_requestingDocument(requestingDocument)
{
@@ -95,8 +96,6 @@
return m_initiatorType;
}
-// FIXME: Need to enforce same-origin policy on these.
-
double PerformanceResourceTiming::redirectStart() const
{
// FIXME: Need to track and report redirects for resources.
@@ -145,7 +144,8 @@
if (!m_shouldReportDetails)
return 0.0;
- if (!m_timing || m_timing->connectStart < 0) // Connection was reused.
+ // connectStart will be -1 when a network request is not made.
+ if (!m_timing || m_timing->connectStart < 0 || m_didReuseConnection)
return domainLookupEnd();
// connectStart includes any DNS time, so we may need to trim that off.
@@ -161,7 +161,8 @@
if (!m_shouldReportDetails)
return 0.0;
- if (!m_timing || m_timing->connectEnd < 0) // Connection was reused.
+ // connectStart will be -1 when a network request is not made.
+ if (!m_timing || m_timing->connectEnd < 0 || m_didReuseConnection)
return connectStart();
return resourceTimeToDocumentMilliseconds(m_timing->connectEnd);
Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.h (137771 => 137772)
--- trunk/Source/WebCore/page/PerformanceResourceTiming.h 2012-12-14 22:18:23 UTC (rev 137771)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.h 2012-12-14 22:30:20 UTC (rev 137772)
@@ -79,6 +79,7 @@
AtomicString m_initiatorType;
RefPtr<ResourceLoadTiming> m_timing;
double m_finishTime;
+ bool m_didReuseConnection;
bool m_shouldReportDetails;
RefPtr<Document> m_requestingDocument;
};