From 587a6a066af0034e75e4f692aa8313b5ac135331 Mon Sep 17 00:00:00 2001 From: Yoav Weiss Date: Fri, 1 Feb 2019 11:40:11 +0000 Subject: [PATCH] Bug 1523562 [wpt PR 14845] - [resource-timing] Modify is_secure_context_ based on resource, a=testonly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic update from web-platform-tests [resource-timing] Modify is_secure_context_ based on resource This is a followup on [1], which fixes the case where the document's protocol and the resource's protocol are not the same, and adds tests to that effect. [1]https://chromium-review.googlesource.com/c/chromium/src/+/1396129 Change-Id: I7e0fda2e1275cb38359bf5781994f1b273248e4d Reviewed-on: https://chromium-review.googlesource.com/c/1409446 Commit-Queue: Yoav Weiss Reviewed-by: Nicolás Peña Moreno Cr-Commit-Position: refs/heads/master@{#623889} -- wpt-commits: 4851d0827f2dc5762d257473e2d917bf4fc7ba69 wpt-pr: 14845 --- .../resource_connection_reuse.html | 2 +- .../resource_connection_reuse.https.html | 2 +- ...source_connection_reuse_mixed_content.html | 55 +++++++++++++++++++ ...nnection_reuse_mixed_content_redirect.html | 55 +++++++++++++++++++ .../resources/fake_responses.py | 9 ++- .../resources/fake_responses_https.sub.html | 18 ++++++ .../fake_responses_https_redirect.sub.html | 20 +++++++ 7 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 testing/web-platform/tests/resource-timing/resource_connection_reuse_mixed_content.html create mode 100644 testing/web-platform/tests/resource-timing/resource_connection_reuse_mixed_content_redirect.html create mode 100644 testing/web-platform/tests/resource-timing/resources/fake_responses_https.sub.html create mode 100644 testing/web-platform/tests/resource-timing/resources/fake_responses_https_redirect.sub.html diff --git a/testing/web-platform/tests/resource-timing/resource_connection_reuse.html b/testing/web-platform/tests/resource-timing/resource_connection_reuse.html index 7a31a7e1ab31..f347a0b23e15 100644 --- a/testing/web-platform/tests/resource-timing/resource_connection_reuse.html +++ b/testing/web-platform/tests/resource-timing/resource_connection_reuse.html @@ -41,7 +41,7 @@ function onload_test() { 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'); if(!window.isSecureConnection) { - test_equals(entry.secureConnectionStart, 0, 'secureConnectStart should be zero'); + test_equals(entry.secureConnectionStart, 0, 'secureConnectionStart 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') diff --git a/testing/web-platform/tests/resource-timing/resource_connection_reuse.https.html b/testing/web-platform/tests/resource-timing/resource_connection_reuse.https.html index bc79a8519b20..86864090a2ee 100644 --- a/testing/web-platform/tests/resource-timing/resource_connection_reuse.https.html +++ b/testing/web-platform/tests/resource-timing/resource_connection_reuse.https.html @@ -40,7 +40,7 @@ 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'); + test_equals(entry.fetchStart, entry.secureConnectionStart, 'secureConnectionStart 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') } diff --git a/testing/web-platform/tests/resource-timing/resource_connection_reuse_mixed_content.html b/testing/web-platform/tests/resource-timing/resource_connection_reuse_mixed_content.html new file mode 100644 index 000000000000..51c04ee604c9 --- /dev/null +++ b/testing/web-platform/tests/resource-timing/resource_connection_reuse_mixed_content.html @@ -0,0 +1,55 @@ + + + + +Resource Timing connection reuse + + + + + + + + +

Description

+

This test validates that connectStart and connectEnd are the same when a connection is reused (e.g. when a persistent connection is used).

+
+ + + diff --git a/testing/web-platform/tests/resource-timing/resource_connection_reuse_mixed_content_redirect.html b/testing/web-platform/tests/resource-timing/resource_connection_reuse_mixed_content_redirect.html new file mode 100644 index 000000000000..a46d14c9f159 --- /dev/null +++ b/testing/web-platform/tests/resource-timing/resource_connection_reuse_mixed_content_redirect.html @@ -0,0 +1,55 @@ + + + + +Resource Timing connection reuse + + + + + + + + +

Description

+

This test validates that connectStart and connectEnd are the same when a connection is reused (e.g. when a persistent connection is used).

+
+ + + diff --git a/testing/web-platform/tests/resource-timing/resources/fake_responses.py b/testing/web-platform/tests/resource-timing/resources/fake_responses.py index f71693818cb7..289c17931767 100644 --- a/testing/web-platform/tests/resource-timing/resources/fake_responses.py +++ b/testing/web-platform/tests/resource-timing/resources/fake_responses.py @@ -2,13 +2,20 @@ def main(request, response): tag = request.GET.first("tag", None) + redirect = request.GET.first("redirect", None) match = request.headers.get("If-None-Match", None) date = request.GET.first("date", "") modified = request.headers.get("If-Modified-Since", None) + response.headers.set("Access-Control-Allow-Origin", "*"); + response.headers.set("Timing-Allow-Origin", "*"); if tag: response.headers.set("ETag", '"%s"' % tag) elif date: response.headers.set("Last-Modified", date) + if redirect: + response.headers.set("Location", redirect) + response.status = (302, "Moved") + return "" if ((match is not None and match == tag) or (modified is not None and modified == date)): @@ -16,4 +23,4 @@ def main(request, response): return "" else: response.headers.set("Content-Type", "text/plain") - return "MAYBE NOT" \ No newline at end of file + return "MAYBE NOT" diff --git a/testing/web-platform/tests/resource-timing/resources/fake_responses_https.sub.html b/testing/web-platform/tests/resource-timing/resources/fake_responses_https.sub.html new file mode 100644 index 000000000000..cf49fb914beb --- /dev/null +++ b/testing/web-platform/tests/resource-timing/resources/fake_responses_https.sub.html @@ -0,0 +1,18 @@ + + + diff --git a/testing/web-platform/tests/resource-timing/resources/fake_responses_https_redirect.sub.html b/testing/web-platform/tests/resource-timing/resources/fake_responses_https_redirect.sub.html new file mode 100644 index 000000000000..c55e037d1dc1 --- /dev/null +++ b/testing/web-platform/tests/resource-timing/resources/fake_responses_https_redirect.sub.html @@ -0,0 +1,20 @@ + + +