Bug 1233891 - Use defer module instead of deprecated-sync-thenable. r=jryans
MozReview-Commit-ID: 6KNRbw1uxsg
--- a/devtools/shared/client/breakpoint-client.js
+++ b/devtools/shared/client/breakpoint-client.js
@@ -1,18 +1,17 @@
/* 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 promise = require("devtools/shared/deprecated-sync-thenables");
-
const eventSource = require("devtools/shared/client/event-source");
const {DebuggerClient} = require("devtools/shared/client/debugger-client");
+const defer = require("devtools/shared/defer");
/**
* Breakpoint clients are used to remove breakpoints that are no longer used.
*
* @param client DebuggerClient
* The debugger client parent.
* @param sourceClient SourceClient
* The source where this breakpoint exists
@@ -84,17 +83,17 @@ BreakpointClient.prototype = {
return this.conditionalExpression;
},
/**
* Set the condition of this breakpoint
*/
setCondition: function(gThreadClient, condition) {
const root = this._client.mainRoot;
- const deferred = promise.defer();
+ const deferred = defer();
if (root.traits.conditionalBreakpoints) {
const info = {
line: this.location.line,
column: this.location.column,
condition: condition
};
--- a/devtools/shared/client/debugger-client.js
+++ b/devtools/shared/client/debugger-client.js
@@ -1,15 +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 Services = require("Services");
+const defer = require("devtools/shared/defer");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const { getStack, callFunctionWithAsyncStack } = require("devtools/shared/platform/stack");
const eventSource = require("devtools/shared/client/event-source");
const {
ThreadStateTypes,
UnsolicitedNotifications,
UnsolicitedPauses,
@@ -164,17 +165,17 @@ DebuggerClient.prototype = {
*
* @return Promise
* Resolves once connected with an array whose first element
* is the application type, by default "browser", and the second
* element is the traits object (help figure out the features
* and behaviors of the server we connect to. See RootActor).
*/
connect: function(onConnected) {
- const deferred = promise.defer();
+ const deferred = defer();
this.addOneTimeListener("connected", (name, applicationType, traits) => {
this.traits = traits;
if (onConnected) {
onConnected(applicationType, traits);
}
deferred.resolve([applicationType, traits]);
});
@@ -249,17 +250,17 @@ DebuggerClient.prototype = {
* @param onClosed function
* If specified, will be called when the debugging connection
* has been closed. This parameter is deprecated - please use
* the returned Promise.
* @return Promise
* Resolves after the underlying transport is closed.
*/
close: function(onClosed) {
- const deferred = promise.defer();
+ const deferred = defer();
if (onClosed) {
deferred.promise.then(onClosed);
}
// Disable detach event notifications, because event handlers will be in a
// cleared scope by the time they run.
this._eventsEnabled = false;
@@ -545,17 +546,17 @@ DebuggerClient.prototype = {
}
const request = new Request(packet);
request.format = "json";
request.stack = getStack();
// Implement a Promise like API on the returned object
// that resolves/rejects on request response
- const deferred = promise.defer();
+ const deferred = defer();
function listenerJson(resp) {
removeRequestListeners();
if (resp.error) {
deferred.reject(safeOnResponse(resp));
} else {
deferred.resolve(safeOnResponse(resp));
}
}