Bug 1354883 - convert uses of 'defer' to 'new Promise' in client/canvasdebugger draft
authorgvso <valentin2507@gmail.com>
Tue, 13 Mar 2018 12:27:03 -0400
changeset 766952 333f654881a428b98f0f6441366b29916b5e55e2
parent 766824 8f1b2f872f0ea358a0412eb8b8687f08d47f6621
child 766953 b89a5e025de6b8c21c8918e4e9f85b7b0390c2c3
push id102460
push userbmo:valentin2507@gmail.com
push dateTue, 13 Mar 2018 17:38:57 +0000
bugs1354883
milestone61.0a1
Bug 1354883 - convert uses of 'defer' to 'new Promise' in client/canvasdebugger MozReview-Commit-ID: 2pSdTOUPwo
devtools/client/canvasdebugger/canvasdebugger.js
devtools/client/canvasdebugger/panel.js
devtools/client/canvasdebugger/test/browser_canvas-frontend-snapshot-select-01.js
--- a/devtools/client/canvasdebugger/canvasdebugger.js
+++ b/devtools/client/canvasdebugger/canvasdebugger.js
@@ -1,17 +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 { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
 const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
 const { SideMenuWidget } = require("resource://devtools/client/shared/widgets/SideMenuWidget.jsm");
-const promise = require("promise");
 const Services = require("Services");
 const EventEmitter = require("devtools/shared/event-emitter");
 const { CallWatcherFront } = require("devtools/shared/fronts/call-watcher");
 const { CanvasFront } = require("devtools/shared/fronts/canvas");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const { extend } = require("devtools/shared/extend");
 const flags = require("devtools/shared/flags");
 const { LocalizationHelper } = require("devtools/shared/l10n");
@@ -98,28 +97,28 @@ const CALLS_LIST_SLOW_SAVE_DELAY = 100; 
  * The current target and the Canvas front, set by this tool's host.
  */
 var gToolbox, gTarget, gFront;
 
 /**
  * Initializes the canvas debugger controller and views.
  */
 function startupCanvasDebugger() {
-  return promise.all([
+  return Promise.all([
     EventsHandler.initialize(),
     SnapshotsListView.initialize(),
     CallsListView.initialize()
   ]);
 }
 
 /**
  * Destroys the canvas debugger controller and views.
  */
 function shutdownCanvasDebugger() {
-  return promise.all([
+  return Promise.all([
     EventsHandler.destroy(),
     SnapshotsListView.destroy(),
     CallsListView.destroy()
   ]);
 }
 
 /**
  * Functions handling target-related lifetime events.
--- a/devtools/client/canvasdebugger/panel.js
+++ b/devtools/client/canvasdebugger/panel.js
@@ -1,17 +1,16 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* 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, Cu, Cr } = require("chrome");
-const promise = require("promise");
 const EventEmitter = require("devtools/shared/event-emitter");
 const { CanvasFront } = require("devtools/shared/fronts/canvas");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 
 function CanvasDebuggerPanel(iframeWindow, toolbox) {
   this.panelWin = iframeWindow;
   this._toolbox = toolbox;
   this._destroyer = null;
@@ -30,17 +29,17 @@ CanvasDebuggerPanel.prototype = {
    */
   open: function () {
     let targetPromise;
 
     // Local debugging needs to make the target remote.
     if (!this.target.isRemote) {
       targetPromise = this.target.makeRemote();
     } else {
-      targetPromise = promise.resolve(this.target);
+      targetPromise = Promise.resolve(this.target);
     }
 
     return targetPromise
       .then(() => {
         this.panelWin.gToolbox = this._toolbox;
         this.panelWin.gTarget = this.target;
         this.panelWin.gFront = new CanvasFront(this.target.client, this.target.form);
         return this.panelWin.startupCanvasDebugger();
--- a/devtools/client/canvasdebugger/test/browser_canvas-frontend-snapshot-select-01.js
+++ b/devtools/client/canvasdebugger/test/browser_canvas-frontend-snapshot-select-01.js
@@ -63,30 +63,30 @@ async function ifTestingSupported() {
     "The first snapshot should now be re-selected.");
   is(CallsListView.selectedIndex, -1,
     "There should still be no call item automatically selected in the snapshot.");
 
   function recordAndWaitForFirstSnapshot() {
     let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
     let snapshotSelected = waitForSnapshotSelection();
     SnapshotsListView._onRecordButtonClick();
-    return promise.all([recordingFinished, snapshotSelected]);
+    return Promise.all([recordingFinished, snapshotSelected]);
   }
 
   function recordAndWaitForAnotherSnapshot() {
     let recordingFinished = once(window, EVENTS.SNAPSHOT_RECORDING_FINISHED);
     SnapshotsListView._onRecordButtonClick();
     return recordingFinished;
   }
 
   function waitForSnapshotSelection() {
     let callListPopulated = once(window, EVENTS.CALL_LIST_POPULATED);
     let thumbnailsDisplayed = once(window, EVENTS.THUMBNAILS_DISPLAYED);
     let screenshotDisplayed = once(window, EVENTS.CALL_SCREENSHOT_DISPLAYED);
-    return promise.all([
+    return Promise.all([
       callListPopulated,
       thumbnailsDisplayed,
       screenshotDisplayed
     ]);
   }
 
   await teardown(panel);
   finish();