Bug 1273941 - replace uses of promise.defer in devtools/client/eyedropper; r=jryans
authorTom Tromey <tom@tromey.com>
Thu, 09 Jun 2016 09:06:35 -0600
changeset 302534 bdea53872708d0cfcfdbbcd8c2b61724ade3e51f
parent 302533 3489bbcc48864251f7242fb92f41af1edb031ffa
child 302535 6a0db3b0afcf0f7b41195d2cc725c0e472356323
push id30364
push userkwierso@gmail.com
push dateFri, 24 Jun 2016 20:31:56 +0000
treeherdermozilla-central@9dac1358aaad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1273941
milestone50.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 1273941 - replace uses of promise.defer in devtools/client/eyedropper; r=jryans MozReview-Commit-ID: HXXirB104d9
devtools/client/eyedropper/eyedropper.js
devtools/client/eyedropper/test/head.js
--- a/devtools/client/eyedropper/eyedropper.js
+++ b/devtools/client/eyedropper/eyedropper.js
@@ -5,16 +5,17 @@
 "use strict";
 
 const {Cc, Ci} = require("chrome");
 const {rgbToHsl, rgbToColorName} =
       require("devtools/client/shared/css-color").colorUtils;
 const Telemetry = require("devtools/client/shared/telemetry");
 const EventEmitter = require("devtools/shared/event-emitter");
 const promise = require("promise");
+const defer = require("devtools/shared/defer");
 const Services = require("Services");
 
 loader.lazyGetter(this, "clipboardHelper", function () {
   return Cc["@mozilla.org/widget/clipboardhelper;1"]
     .getService(Ci.nsIClipboardHelper);
 });
 
 loader.lazyGetter(this, "ssService", function () {
@@ -196,17 +197,17 @@ Eyedropper.prototype = {
 
   /**
    * Fetch a screenshot of the content.
    *
    * @return {promise}
    *         Promise that resolves with the screenshot as a dataURL
    */
   getContentScreenshot: function () {
-    let deferred = promise.defer();
+    let deferred = defer();
 
     let mm = this._contentTab.linkedBrowser.messageManager;
     function onScreenshot(message) {
       mm.removeMessageListener("Eyedropper:Screenshot", onScreenshot);
       deferred.resolve(message.data);
     }
     mm.addMessageListener("Eyedropper:Screenshot", onScreenshot);
     mm.sendAsyncMessage("Eyedropper:RequestContentScreenshot");
@@ -218,17 +219,17 @@ Eyedropper.prototype = {
    * Start the eyedropper. Add listeners for a mouse move in the window to
    * show the eyedropper.
    */
   open: function () {
     if (this.isOpen) {
       // the eyedropper is aready open, don't create another panel.
       return promise.resolve();
     }
-    let deferred = promise.defer();
+    let deferred = defer();
 
     this.isOpen = true;
 
     this._showCrosshairs();
 
     // Get screenshot of content so we can inspect colors
     this.getContentScreenshot().then((dataURL) => {
       this._contentImage = new this._chromeWindow.Image();
--- a/devtools/client/eyedropper/test/head.js
+++ b/devtools/client/eyedropper/test/head.js
@@ -3,17 +3,17 @@
 
 // shared-head.js handles imports, constants, and utility functions
 Services.scriptloader.loadSubScript("chrome://mochitests/content/browser/devtools/client/framework/test/shared-head.js", this);
 Services.scriptloader.loadSubScript(TEST_DIR + "../../../commandline/test/helpers.js", this);
 
 const { Eyedropper, EyedropperManager } = require("devtools/client/eyedropper/eyedropper");
 
 function waitForClipboard(setup, expected) {
-  let deferred = promise.defer();
+  let deferred = defer();
   SimpleTest.waitForClipboard(expected, setup, deferred.resolve, deferred.reject);
   return deferred.promise;
 }
 
 function dropperStarted(dropper) {
   if (dropper.isStarted) {
     return promise.resolve();
   }