michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: module.metadata = { michael@0: "stability": "unstable" michael@0: }; michael@0: michael@0: const { Cc, Ci, components: { ID: parseUUID } } = require('chrome'); michael@0: const { generateUUID } = Cc['@mozilla.org/uuid-generator;1']. michael@0: getService(Ci.nsIUUIDGenerator); michael@0: michael@0: // Returns `uuid`. If `id` is passed then it's parsed to `uuid` and returned michael@0: // if not then new one is generated. michael@0: exports.uuid = function uuid(id) id ? parseUUID(id) : generateUUID()