diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 11:14:55 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 11:14:55 -0500 |
commit | e2ddd038719a70ec4f3ce4b467ce27f148b26373 (patch) | |
tree | 672276f51a40efb8f41a6dd67dc75ab16cadbf45 | |
parent | e911e0061503446ecbc3b3d35f45135ab9b999c4 (diff) | |
download | UXP-e2ddd038719a70ec4f3ce4b467ce27f148b26373.tar UXP-e2ddd038719a70ec4f3ce4b467ce27f148b26373.tar.gz UXP-e2ddd038719a70ec4f3ce4b467ce27f148b26373.tar.lz UXP-e2ddd038719a70ec4f3ce4b467ce27f148b26373.tar.xz UXP-e2ddd038719a70ec4f3ce4b467ce27f148b26373.zip |
Use the uuid-generator service instead of mangling a random number generator result to generate a syncGUID
-rw-r--r-- | toolkit/mozapps/extensions/internal/XPIProvider.jsm | 12 |
1 files changed, 4 insertions, 8 deletions
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; } |