mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
Use the uuid-generator service instead of mangling a random number generator result to generate a syncGUID
This commit is contained in:
parent
b8b5ce0305
commit
a0f91b5bfa
1 changed files with 4 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue