Bug 1517776 [wpt PR 14719] - [resource-timing] test_resource_timing.html to pass also when run in HTTPS, a=testonly
authorYoav Weiss <yoav@yoav.ws>
Thu, 31 Jan 2019 15:44:54 +0000
changeset 457880 a51145a90ee003d2c8e92b383874a95ffe1cba6d
parent 457879 e2fe0e1434525ad3973b9b513fda3453fb9695d1
child 457881 4f2fb429edd84e4a4a4b573ad5415afd89a66596
push id35518
push useropoprus@mozilla.com
push dateFri, 08 Feb 2019 09:55:14 +0000
treeherdermozilla-central@3a3e393396f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1517776, 14719
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1517776 [wpt PR 14719] - [resource-timing] test_resource_timing.html to pass also when run in HTTPS, a=testonly Automatic update from web-platform-tests [resource-timing] test_resource_timing.html to pass also when run in HTTPS (#14719) * [resource-timing] test_resource_timing.html to pass also when run in HTTPS * Make sure it fails when secureConnectionStart does not match the protocol * Added an HTTPS variant -- wpt-commits: 7e9b30139157f7e7eac2ef2f4fabc88bdc3f0e05 wpt-pr: 14719
testing/web-platform/tests/resource-timing/test_resource_timing.https.html
testing/web-platform/tests/resource-timing/test_resource_timing.js
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/test_resource_timing.https.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta charset="UTF-8" />
+        <title>window.performance Resource Timing Entries exist</title>
+        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
+        <link rel="help" href="https://w3c.github.io/web-performance/specs/ResourceTiming/Overview.html"/>
+        <script src="/resources/testharness.js"></script>
+        <script src="/resources/testharnessreport.js"></script>
+        <script src="test_resource_timing.js"></script>
+    </head>
+    <body>
+        <h1>Description</h1>
+        <p>
+           NOTE: Due to caching behavior in the browser, it is possible that when revisiting this page, some resources
+           may not have to be fetched from the network.  As a result, the performance timeline will not contain entries
+           for these resources. This test will fail if any entries are missing to ensure that all resources are fetched
+           from the network and entries for these resources exist in the Performance Timeline.  If revisiting this page,
+           please either perform a full reload of the page or clear the cache between visits.
+        </p>
+
+        <div id="log"></div>
+    </body>
+</html>
--- a/testing/web-platform/tests/resource-timing/test_resource_timing.js
+++ b/testing/web-platform/tests/resource-timing/test_resource_timing.js
@@ -181,32 +181,31 @@ function resource_load(expected)
         assert_equals(actual.duration, (actual.responseEnd - actual.startTime));
         this.done();
     });
 
     t["timing_attrs"].step(function test() {
         const entries = window.performance.getEntriesByName(expected.name);
         assert_equals(entries.length, 1, 'There should be a single matching entry');
         const actual = entries[0];
-
-        // Debugging bug 1263428
-        // Feel free to remove/overwrite this piece of code
-        if (actual.connectStart < actual.domainLookupEnd) {
-            assert_true(false, "actual: "+JSON.stringify(actual));
+        if (window.location.protocol == "http:") {
+            assert_equals(actual.secureConnectionStart, 0, 'secureConnectionStart should be 0 in http');
+        } else {
+            assert_greater_than(actual.secureConnectionStart, 0, 'secureConnectionStart should not be 0 in https');
         }
 
         assert_equals(actual.redirectStart, 0, 'redirectStart should be 0');
         assert_equals(actual.redirectEnd, 0, 'redirectEnd should be 0');
-        assert_true(actual.secureConnectionStart == undefined ||
-                    actual.secureConnectionStart == 0, 'secureConnectionStart should be 0 or undefined');
         assert_equals(actual.fetchStart, actual.startTime, 'fetchStart is equal to startTime');
         assert_greater_than_equal(actual.domainLookupStart, actual.fetchStart, 'domainLookupStart after fetchStart');
         assert_greater_than_equal(actual.domainLookupEnd, actual.domainLookupStart, 'domainLookupEnd after domainLookupStart');
         assert_greater_than_equal(actual.connectStart, actual.domainLookupEnd, 'connectStart after domainLookupEnd');
         assert_greater_than_equal(actual.connectEnd, actual.connectStart, 'connectEnd after connectStart');
+        assert_true(actual.secureConnectionStart == 0 || actual.secureConnectionStart <= actual.requestStart,
+            "secureConnectionStart should be either 0 or smaller than/equals to requestStart")
         assert_greater_than_equal(actual.requestStart, actual.connectEnd, 'requestStart after connectEnd');
         assert_greater_than_equal(actual.responseStart, actual.requestStart, 'responseStart after requestStart');
         assert_greater_than_equal(actual.responseEnd, actual.responseStart, 'responseEnd after responseStart');
         this.done();
     });
 
     t["network_attrs"].step(function test() {
         var actual = window.performance.getEntriesByName(expected.name)[0];