Bug 1262439 - 6 - Update the eye-dropper devtools menu entry to use the new eye-dropper; r=ochameau
authorPatrick Brosset <pbrosset@mozilla.com>
Thu, 09 Jun 2016 13:19:09 +0200
changeset 331365 1a7579d0bf7461b5cd9362745b21f12c15321a79
parent 331364 bf3e4deee24c1440f41bb655bfc62da3df4f118a
child 331366 17f383218326a3c3e26ecfd6634ca1fa7d12a43e
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1262439
milestone50.0a1
Bug 1262439 - 6 - Update the eye-dropper devtools menu entry to use the new eye-dropper; r=ochameau Removes some old eye-dropper related code in browser.js which was not used anymore since the devtools menu are added dynamically now. And replaces the code in devtools/client/menus.js to call the gcli eyedropper command now instead of the old eyedropper tool. MozReview-Commit-ID: DMn9eiVOnGY
browser/base/content/browser.js
devtools/client/menus.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -7730,31 +7730,16 @@ var ResponsiveUI = {
 };
 
 XPCOMUtils.defineLazyGetter(ResponsiveUI, "ResponsiveUIManager", function() {
   let tmp = {};
   Cu.import("resource://devtools/client/responsivedesign/responsivedesign.jsm", tmp);
   return tmp.ResponsiveUIManager;
 });
 
-function openEyedropper() {
-  var eyedropper = new this.Eyedropper(this, { context: "menu",
-                                               copyOnSelect: true });
-  eyedropper.open();
-}
-
-Object.defineProperty(this, "Eyedropper", {
-  get: function() {
-    let devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools;
-    return devtools.require("devtools/client/eyedropper/eyedropper").Eyedropper;
-  },
-  configurable: true,
-  enumerable: true
-});
-
 XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () {
   // Only show resizers on Windows 2000 and XP
   return AppConstants.isPlatformAndVersionAtMost("win", "5.9");
 });
 
 var MousePosTracker = {
   _listeners: new Set(),
   _x: 0,
--- a/devtools/client/menus.js
+++ b/devtools/client/menus.js
@@ -32,17 +32,18 @@
  *   If true, the menuitem is prefixed by a checkbox and runtime code can
  *   toggle it.
  */
 
 const Services = require("Services");
 const isMac = Services.appinfo.OS === "Darwin";
 
 loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true);
-loader.lazyRequireGetter(this, "Eyedropper", "devtools/client/eyedropper/eyedropper", true);
+loader.lazyRequireGetter(this, "CommandUtils", "devtools/client/shared/developer-toolbar", true);
+loader.lazyRequireGetter(this, "TargetFactory", "devtools/client/framework/target", true);
 
 loader.lazyImporter(this, "BrowserToolboxProcess", "resource://devtools/client/framework/ToolboxProcess.jsm");
 loader.lazyImporter(this, "ResponsiveUIManager", "resource://devtools/client/responsivedesign/responsivedesign.jsm");
 loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scratchpad/scratchpad-manager.jsm");
 
 exports.menuitems = [
   { id: "menu_devToolbox",
     l10nKey: "devToolboxMenuItem",
@@ -139,19 +140,23 @@ exports.menuitems = [
       keytext: true
     },
     checkbox: true
   },
   { id: "menu_eyedropper",
     l10nKey: "eyedropper",
     oncommand(event) {
       let window = event.target.ownerDocument.defaultView;
-      let eyedropper = new Eyedropper(window, { context: "menu",
-                                                copyOnSelect: true });
-      eyedropper.open();
+      let target = TargetFactory.forTab(window.gBrowser.selectedTab);
+
+      CommandUtils.createRequisition(target, {
+        environment: CommandUtils.createEnvironment({target})
+      }).then(requisition => {
+        requisition.updateExec("eyedropper");
+      }, e => console.error(e));
     },
     checkbox: true
   },
   { id: "menu_scratchpad",
     l10nKey: "scratchpad",
     oncommand() {
       ScratchpadManager.openScratchpad();
     },