From e2ddd038719a70ec4f3ce4b467ce27f148b26373 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sat, 10 Feb 2018 11:14:55 -0500 Subject: Use the uuid-generator service instead of mangling a random number generator result to generate a syncGUID --- toolkit/mozapps/extensions/internal/XPIProvider.jsm | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'toolkit/mozapps') diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 613903a44..76b4e653b 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -987,14 +987,10 @@ function loadManifestFromRDF(aUri, aStream) { // Generate random GUID used for Sync. // This was lifted from util.js:makeGUID() from services-sync. - let rng = Cc["@mozilla.org/security/random-generator;1"]. - createInstance(Ci.nsIRandomGenerator); - let bytes = rng.generateRandomBytes(9); - let byte_string = [String.fromCharCode(byte) for each (byte in bytes)] - .join(""); - // Base64 encode - addon.syncGUID = btoa(byte_string).replace(/\+/g, '-') - .replace(/\//g, '_'); + let guid = Cc["@mozilla.org/uuid-generator;1"] + .getService(Ci.nsIUUIDGenerator) + .generateUUID().toString(); + addon.syncGUID = guid; return addon; } -- cgit v1.2.3