Bug 1517886 [wpt PR 14724] - [Resource-Timing] Fix non-zero secureConnectionStart in cleartext http, a=testonly

Automatic update from web-platform-tests
[Resource-Timing] Fix non-zero secureConnectionStart in cleartext http

It seems we introduced[1] an issue into secureConnectionStart values
where we wrongfully expose the fetchStart value there in cases where the
connection is not secure.
I'm fixing the spec[2], as it was a literal implementation of the "on
getting" processing there. This CL fixes our implementation.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1363906
[2] https://github.com/w3c/resource-timing/pull/194

Change-Id: Ib5e74ff70eddb0a96506e8955c5df2b01cc3d73a
Reviewed-on: https://chromium-review.googlesource.com/c/1396129
Reviewed-by: Yoav Weiss <yoav@yoav.ws>
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Reviewed-by: Liquan (Max) Gu <maxlg@chromium.org>
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620352}

--

wpt-commits: 56918ee647b325c9c45ca0048268ae90539db6ef
wpt-pr: 14724
This commit is contained in:
Yoav Weiss 2019-01-31 18:30:09 +00:00 коммит произвёл James Graham
Родитель d243cc7505
Коммит 7c12fc9283
2 изменённых файлов: 63 добавлений и 3 удалений

Просмотреть файл

@ -21,7 +21,6 @@ test_namespace('getEntriesByType');
function setup_iframe() {
iframe = document.getElementById('frameContext');
d = iframe.contentWindow.document;
iframeBody = d.body;
iframe.addEventListener('load', onload_test, false);
}
@ -41,10 +40,11 @@ function onload_test() {
const entry = entries[1];
test_equals(entry.fetchStart, entry.connectStart, 'connectStart and fetchStart should be the same');
test_equals(entry.fetchStart, entry.connectEnd, 'connectEnd and fetchStart should be the same');
test_equals(entry.fetchStart, entry.secureConnectionStart, 'secureConnectStart and fetchStart should be the same');
if(!window.isSecureConnection) {
test_equals(entry.secureConnectionStart, 0, 'secureConnectStart should be zero');
}
test_equals(entry.fetchStart, entry.domainLookupStart, 'domainLookupStart and fetchStart should be the same')
test_equals(entry.fetchStart, entry.domainLookupEnd, 'domainLookupEnd and fetchStart should be the same')
}
done();

Просмотреть файл

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Resource Timing connection reuse</title>
<link rel="author" title="Google" href="http://www.google.com/" />
<link rel="help" href="https://www.w3.org/TR/resource-timing/#dom-performanceresourcetiming-initiatortype"/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/webperftestharness.js"></script>
<script src="resources/webperftestharnessextension.js"></script>
<script>
setup({explicit_done: true});
let iframe;
let d;
let body;
// Explicitly test the namespace before we start testing.
test_namespace('getEntriesByType');
function setup_iframe() {
iframe = document.getElementById('frameContext');
d = iframe.contentWindow.document;
iframe.addEventListener('load', onload_test, false);
}
function onload_test() {
if (window.performance.getEntriesByType === undefined) {
done();
return;
}
const context = new PerformanceContext(iframe.contentWindow.performance);
const entries = context.getEntriesByType('resource');
// When a persistent connection is used, follow-on resources should be included as PerformanceResourceTiming objects.
test_equals(entries.length, 2, 'There should be 2 PerformanceEntries');
if (entries.length >= 2) {
// When a persistent connection is used, for the resource that reuses the socket, connectStart and connectEnd should have the same value as fetchStart.
const entry = entries[1];
test_equals(entry.fetchStart, entry.connectStart, 'connectStart and fetchStart should be the same');
test_equals(entry.fetchStart, entry.connectEnd, 'connectEnd and fetchStart should be the same');
test_equals(entry.fetchStart, entry.secureConnectionStart, 'secureConnectStart and fetchStart should be the same');
test_equals(entry.fetchStart, entry.domainLookupStart, 'domainLookupStart and fetchStart should be the same')
test_equals(entry.fetchStart, entry.domainLookupEnd, 'domainLookupEnd and fetchStart 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 (e.g. when a persistent connection is used).</p>
<div id="log"></div>
<iframe id="frameContext" src="resources/fake_responses.html"></iframe>
</body>
</html>