Bug 1276490 - Do not use Math.random() to create unique values to avoid intermittent failrues. r=jgraham
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 31 May 2016 06:51:27 +0900
changeset 340619 da391c890d07976d7bcb5bd7223ba6a07a00992f
parent 340618 88c344a56eac7c61656af0c56294ebd73317a3af
child 340620 cb8a9f6e77e85c3107d3f29f68bd9d39f1cadd4f
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1276490
milestone49.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 1276490 - Do not use Math.random() to create unique values to avoid intermittent failrues. r=jgraham MozReview-Commit-ID: 3QHrpCTpEzM
testing/web-platform/tests/performance-timeline/po-resource.html
--- a/testing/web-platform/tests/performance-timeline/po-resource.html
+++ b/testing/web-platform/tests/performance-timeline/po-resource.html
@@ -10,21 +10,25 @@ New resources will <a href="https://w3c.
 </p>
 <div id="log"></div>
 <script>
   async_test(function (t) {
     function path(pathname) {
       var filename = pathname.substring(pathname.lastIndexOf('/')+1);
       return pathname.substring(0, pathname.length - filename.length);
     }
+    var gUniqueCounter = 0;
+    function generateUniqueValues() {
+      return Date.now() + "-" + (++gUniqueCounter);
+    }
     var stored_entries = [];
     var img_location = document.location.origin + path(document.location.pathname)
        + "resources/square.png?random=";
-    var img1 = img_location + Math.floor(Math.random() * 100);
-    var img2 = img_location + Math.floor(Math.random() * 1000);
+    var img1 = img_location + generateUniqueValues();
+    var img2 = img_location + generateUniqueValues();
     var observer = new PerformanceObserver(
         t.step_func(function (entryList, obs) {
           stored_entries =
             stored_entries.concat(entryList.getEntriesByType("resource"));
           if (stored_entries.length >= 2) {
             checkEntries(stored_entries,
               [{ entryType: "resource", name: img1},
                { entryType: "resource", name: img2}]);