Bug 927038 - Using nsIUUIDGenerator rather than Date.now(). r=mbrubeck
authorKamil Jozwiak <kamiljoz@gmail.com>
Thu, 07 Nov 2013 23:18:06 -0500
changeset 154093 2ba06be1165ba5952a46eac1bdad06adaf297122
parent 154092 82bc6c4f7e5ba80529e144659f21146e757981cf
child 154094 3e92e917cd7e2014eb997ecb3a4a40a383df96de
push id25622
push usercbook@mozilla.com
push dateFri, 08 Nov 2013 12:32:08 +0000
treeherdermozilla-central@a6e7f0663458 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs927038
milestone28.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 927038 - Using nsIUUIDGenerator rather than Date.now(). r=mbrubeck
browser/metro/base/content/bindings/browser.js
--- a/browser/metro/base/content/bindings/browser.js
+++ b/browser/metro/base/content/bindings/browser.js
@@ -4,16 +4,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 let Cc = Components.classes;
 let Ci = Components.interfaces;
 let Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
+XPCOMUtils.defineLazyServiceGetter(this, "gUUIDGenerator",
+                                   "@mozilla.org/uuid-generator;1", "nsIUUIDGenerator");
+
 let WebProgressListener = {
   _lastLocation: null,
   _firstPaint: false,
 
   init: function() {
     let flags = Ci.nsIWebProgress.NOTIFY_LOCATION |
                 Ci.nsIWebProgress.NOTIFY_SECURITY |
                 Ci.nsIWebProgress.NOTIFY_STATE_WINDOW |
@@ -255,17 +258,17 @@ let WebNavigation =  {
       shEntry.cacheKey = cacheKey;
     }
 
     if (aEntry.ID) {
       // get a new unique ID for this frame (since the one from the last
       // start might already be in use)
       let id = aIdMap[aEntry.ID] || 0;
       if (!id) {
-        for (id = Date.now(); id in aIdMap.used; id++);
+        id = gUUIDGenerator.generateUUID();
         aIdMap[aEntry.ID] = id;
         aIdMap.used[id] = true;
       }
       shEntry.ID = id;
     }
 
     if (aEntry.docshellID)
       shEntry.docshellID = aEntry.docshellID;