Bug 1469988 Fix performance-timeline.https.html to not timeout if bufferfull event is not fired in service worker. r=mrbkap
authorBen Kelly <ben@wanderview.com>
Sat, 23 Jun 2018 10:12:26 -0700
changeset 423430 c74adc90978c1a2182fc89909499e9d4c3075c1f
parent 423429 3f78c17a1ceaaaa4b7e1fa04c3375f96e5acc9c8
child 423431 4ce6cfe17939df34ff3dd7b7a53ba0e2a3b6c90e
push id104570
push userbkelly@mozilla.com
push dateSat, 23 Jun 2018 17:12:35 +0000
treeherdermozilla-inbound@c74adc90978c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1469988
milestone62.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 1469988 Fix performance-timeline.https.html to not timeout if bufferfull event is not fired in service worker. r=mrbkap
testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
testing/web-platform/tests/service-workers/service-worker/resources/performance-timeline-worker.js
--- a/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
+++ b/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
@@ -1,12 +1,5 @@
 prefs: [privacy.reduceTimerPrecision:false]
 [performance-timeline.https.html]
-  expected: TIMEOUT
   [Resource Timing]
-    expected: TIMEOUT
-
-  [Test Performance Timeline API in Service Worker]
-    expected: TIMEOUT
-
-  [empty service worker fetch event included in performance timings]
-    expected: NOTRUN
-
+    expected: FAIL
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1432758
--- a/testing/web-platform/tests/service-workers/service-worker/resources/performance-timeline-worker.js
+++ b/testing/web-platform/tests/service-workers/service-worker/resources/performance-timeline-worker.js
@@ -39,20 +39,30 @@ promise_test(function(test) {
           assert_equals(performance.getEntriesByType('resource').length, expectedResources.length);
           for (var i = 0; i < expectedResources.length; i++) {
               var entry = performance.getEntriesByType('resource')[i];
               assert_true(entry.name.endsWith(expectedResources[i]));
               assert_equals(entry.workerStart, 0);
               assert_greater_than(entry.startTime, 0);
               assert_greater_than(entry.responseEnd, entry.startTime);
           }
-          return new Promise(function(resolve) {
-              performance.onresourcetimingbufferfull = resolve;
+          return Promise.race([
+            new Promise(function(resolve) {
+              performance.onresourcetimingbufferfull = _ => {
+                resolve('bufferfull');
+              }
               performance.setResourceTimingBufferSize(expectedResources.length);
-            });
+            }),
+
+            // Race the bufferfull event against another fetch.  We should get the
+            // event before this completes.  This allows us to detect a failure
+            // to dispatch the event without timing out the entire test.
+            fetch('dummy.txt').then(resp => resp.text())
+          ]);
         })
-      .then(function() {
+      .then(function(result) {
+          assert_equals(result, 'bufferfull');
           performance.clearResourceTimings();
           assert_equals(performance.getEntriesByType('resource').length, 0);
         })
   }, 'Resource Timing');
 
 done();