diff --git a/common/get-host-info.sub.js b/common/get-host-info.sub.js index 53602a632f3387..9b8c2b5de63f28 100644 --- a/common/get-host-info.sub.js +++ b/common/get-host-info.sub.js @@ -10,6 +10,8 @@ function get_host_info() { var HTTPS_PORT2 = '{{ports[https][1]}}'; var PROTOCOL = self.location.protocol; var IS_HTTPS = (PROTOCOL == "https:"); + var PORT = IS_HTTPS ? HTTPS_PORT : HTTP_PORT; + var PORT2 = IS_HTTPS ? HTTPS_PORT2 : HTTP_PORT2; var HTTP_PORT_ELIDED = HTTP_PORT == "80" ? "" : (":" + HTTP_PORT); var HTTP_PORT2_ELIDED = HTTP_PORT2 == "80" ? "" : (":" + HTTP_PORT2); var HTTPS_PORT_ELIDED = HTTPS_PORT == "443" ? "" : (":" + HTTPS_PORT); @@ -24,6 +26,8 @@ function get_host_info() { HTTP_PORT2: HTTP_PORT2, HTTPS_PORT: HTTPS_PORT, HTTPS_PORT2: HTTPS_PORT2, + PORT: PORT, + PORT2: PORT2, ORIGINAL_HOST: ORIGINAL_HOST, REMOTE_HOST: REMOTE_HOST, 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 @@ - - -
- -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..1d8b69c8e9b342 --- /dev/null +++ b/resource-timing/TAO-port-mismatch-means-crossorigin.html @@ -0,0 +1,46 @@ + + + + +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 462284473c0b36..3dc873ac157e4d 100644 --- a/resource-timing/resources/entry-invariants.js +++ b/resource-timing/resources/entry-invariants.js @@ -165,7 +165,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", + ]); } + }; const attribute_test_internal = (loader, path, validator, run_test, test_label) => {