From 1d7328a0c2c5d26f9bfcbc05e78fe055fe290eac Mon Sep 17 00:00:00 2001 From: Tom McKee Date: Mon, 10 May 2021 05:46:06 -0700 Subject: [PATCH] [ResourceTiming] Update TAO-crossorigin-port.sub.html with new style This change rewrites (and renames) the above test to conform to the new style we're introducing to Resource Timing Web Platform Tests. See wpt/resource-timing/CodingingConventions.md for what the new style prescribes. Bug: 1171767 Change-Id: I84df93ab1165ab1e315dc406144791be3b1a5b28 GithubIssue: https://github.com/w3c/resource-timing/issues/254 --- resource-timing/TAO-crossorigin-port.sub.html | 25 ------------- .../TAO-port-mismatch-means-crossorigin.html | 35 +++++++++++++++++++ resource-timing/resources/entry-invariants.js | 25 +++++++++++++ 3 files changed, 60 insertions(+), 25 deletions(-) delete mode 100644 resource-timing/TAO-crossorigin-port.sub.html create mode 100644 resource-timing/TAO-port-mismatch-means-crossorigin.html diff --git a/resource-timing/TAO-crossorigin-port.sub.html b/resource-timing/TAO-crossorigin-port.sub.html deleted file mode 100644 index 0601217d0ae3a7..00000000000000 --- a/resource-timing/TAO-crossorigin-port.sub.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - -Resource Timing TAO - "null" and opaque origin - - - - - - - -

Description

-

This test validates that for a cross origin resource with different ports, the timing allow check algorithm will fail when the value of Timing-Allow-Origin value has the right host but the wrong port in it.

-
- - - - diff --git a/resource-timing/TAO-port-mismatch-means-crossorigin.html b/resource-timing/TAO-port-mismatch-means-crossorigin.html new file mode 100644 index 00000000000000..1dc27fcc373039 --- /dev/null +++ b/resource-timing/TAO-port-mismatch-means-crossorigin.html @@ -0,0 +1,35 @@ + + + + +TAO - port mismatch must fail the check + + + + + + + + + +

Description

+

This test validates that for a cross origin resource with different ports, +the timing allow check algorithm will fail when the value of +Timing-Allow-Origin value has the right host but the wrong port in it.

+ + diff --git a/resource-timing/resources/entry-invariants.js b/resource-timing/resources/entry-invariants.js index eb885e6de20d04..fa852555724f57 100644 --- a/resource-timing/resources/entry-invariants.js +++ b/resource-timing/resources/entry-invariants.js @@ -164,7 +164,32 @@ const invariants = { assert_equals(entry.fetchStart, entry.startTime, "fetchStart must equal startTime"); + }, + + assert_tao_failure_resource: entry => { + assert_equals(entry.entryType, "resource", "entryType must always be 'resource'"); + + assert_positive_(entry, [ + "startTime", + "duration", + ]); + + assert_zeroed_(entry, [ + "redirectStart", + "redirectEnd", + "domainLookupStart", + "domainLookupEnd", + "connectStart", + "connectEnd", + "secureConnectionStart", + "requestStart", + "responseStart", + "transferSize", + "encodedBodySize", + "decodedBodySize", + ]); } + }; // Given a resource-loader, a path (a relative path or absolute URL), and a