Bug 1354883 - convert uses of 'defer' to 'new Promise' in client/canvasdebugger
MozReview-Commit-ID: 2pSdTOUPwo
--- 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();