Bug 1378824 - Stop using sdk/util/uuid in DevTools. r=jdescottes

MozReview-Commit-ID: 18nh2NT5fEE

--HG--
extra : rebase_source : 090b83b70f158d291337abbf2dedb898ef941c84
This commit is contained in:
sole 2017-07-27 11:28:45 +01:00
parent dc857a8098
commit 8877005317
5 changed files with 23 additions and 6 deletions

View File

@ -105,7 +105,7 @@ module.exports = envConfig => {
"method": path.join(__dirname, "../../../addon-sdk/source/lib/method"),
"modules/libpref/init/all":
path.join(__dirname, "../../../modules/libpref/init/all.js"),
"sdk/util/uuid":
"devtools/shared/generate-uuid":
path.join(__dirname, "./webpack/uuid-sham.js"),
"sdk": path.join(__dirname, "../../../addon-sdk/source/lib/sdk"),
"Services": path.join(__dirname, "../shared/shim/Services.js"),
@ -163,4 +163,4 @@ module.exports = envConfig => {
webpackConfig.babelExcludes = /(devtools(\/|\\)|addon-sdk(\/|\\)|modules(\/|\\))/;
return toolboxConfig(webpackConfig, envConfig);
};
};

View File

@ -10,10 +10,10 @@ const s4 = function () {
.substring(1);
};
let uuid = function () {
let generateUUID = function () {
return "ss-s-s-s-sss".replace(/s/g, function () {
return s4();
});
};
module.exports = { uuid };
module.exports = { generateUUID };

View File

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const uuidgen = require("sdk/util/uuid").uuid;
const { generateUUID } = require("devtools/shared/generate-uuid");
const defer = require("devtools/shared/defer");
const {
entries, toObject, executeSoon
@ -17,7 +17,7 @@ function promiseMiddleware({ dispatch, getState }) {
}
const promiseInst = action[PROMISE];
const seqId = uuidgen().toString();
const seqId = generateUUID().toString();
// Create a new action that doesn't have the promise field and has
// the `seqId` field that represents the sequence id

View File

@ -0,0 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { Cc, Ci } = require("chrome");
const { generateUUID } =
Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
/**
* Returns a new `uuid`.
*
*/
module.exports = { generateUUID };

View File

@ -59,6 +59,7 @@ DevToolsModules(
'event-emitter.js',
'extend.js',
'flags.js',
'generate-uuid.js',
'indentation.js',
'l10n.js',
'loader-plugin-raw.jsm',