Bug 1378824 - Stop using sdk/util/uuid in DevTools. r=jdescottes
☠☠ backed out by b11ddbf7ee37 ☠ ☠
authorsole <sole@mozilla.com>
Thu, 27 Jul 2017 11:28:45 +0100
changeset 371434 c0f919689e48052b2a9815e4b756f944bb2a7125
parent 371433 0cce9f38298794e32ee9a29de703ce6813381154
child 371435 7829ceaaec31214c53e8bc098df8ca0d9ac109dd
push id32246
push userkwierso@gmail.com
push dateThu, 27 Jul 2017 23:10:07 +0000
treeherdermozilla-central@a4afa89bfdd1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1378824
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1378824 - Stop using sdk/util/uuid in DevTools. r=jdescottes MozReview-Commit-ID: 18nh2NT5fEE
devtools/client/inspector/webpack.config.js
devtools/client/inspector/webpack/uuid-sham.js
devtools/client/shared/redux/middleware/promise.js
devtools/shared/generate-uuid.js
devtools/shared/moz.build
--- a/devtools/client/inspector/webpack.config.js
+++ b/devtools/client/inspector/webpack.config.js
@@ -100,17 +100,17 @@ module.exports = envConfig => {
           path.join(__dirname, "./webpack/devtools-utils-sham.js"),
         "devtools/shared/locales": path.join(__dirname, "../../shared/locales/en-US"),
         "devtools/shared/platform": path.join(__dirname, "../../shared/platform/content"),
         "devtools": path.join(__dirname, "../../"),
         "gcli": path.join(__dirname, "../../shared/gcli/source/lib/gcli"),
         "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"),
         "toolkit/locales":
           path.join(__dirname, "../../../toolkit/locales/en-US/chrome/global"),
       },
     },
 
@@ -158,9 +158,9 @@ module.exports = envConfig => {
       "devtools/client/shared/developer-toolbar": "{}",
     },
   ];
 
   // Exclude all files from devtools/ or addon-sdk/ or modules/ .
   webpackConfig.babelExcludes = /(devtools(\/|\\)|addon-sdk(\/|\\)|modules(\/|\\))/;
 
   return toolboxConfig(webpackConfig, envConfig);
-};
+};
\ No newline at end of file
--- a/devtools/client/inspector/webpack/uuid-sham.js
+++ b/devtools/client/inspector/webpack/uuid-sham.js
@@ -5,15 +5,15 @@
 "use strict";
 
 const s4 = function () {
   return Math.floor((1 + Math.random()) * 0x10000)
              .toString(16)
              .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 };
--- a/devtools/client/shared/redux/middleware/promise.js
+++ b/devtools/client/shared/redux/middleware/promise.js
@@ -1,28 +1,28 @@
 /* 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 uuidgen = require("sdk/util/uuid").uuid;
+const { generateUUID } = require("devtools/shared/generate-uuid");
 const defer = require("devtools/shared/defer");
 const {
   entries, toObject, executeSoon
 } = require("devtools/shared/DevToolsUtils");
 const PROMISE = exports.PROMISE = "@@dispatch/promise";
 
 function promiseMiddleware({ dispatch, getState }) {
   return next => action => {
     if (!(PROMISE in action)) {
       return next(action);
     }
 
     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
     action = Object.assign(
       toObject(entries(action).filter(pair => pair[0] !== PROMISE)), { seqId }
     );
 
     dispatch(Object.assign({}, action, { status: "start" }));
new file mode 100644
--- /dev/null
+++ b/devtools/shared/generate-uuid.js
@@ -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 };
--- a/devtools/shared/moz.build
+++ b/devtools/shared/moz.build
@@ -54,16 +54,17 @@ DevToolsModules(
     'defer.js',
     'deprecated-sync-thenables.js',
     'DevToolsUtils.js',
     'dom-node-constants.js',
     'dom-node-filter-constants.js',
     'event-emitter.js',
     'extend.js',
     'flags.js',
+    'generate-uuid.js',
     'indentation.js',
     'l10n.js',
     'loader-plugin-raw.jsm',
     'Loader.jsm',
     'Parser.jsm',
     'path.js',
     'plural-form.js',
     'protocol.js',