Bug 943517 - Remove the deprecated-sync-thenables from the debugger server;r=jlong
authorEddy Bruël <ejpbruel@gmail.com>
Tue, 12 May 2015 19:13:56 +0200
changeset 243498 a83fbd4c96b835954b2e1cdceadf9adf1c1b14d9
parent 243497 3d0199c117d48fe3aeb89e4af0f264a9468da9df
child 243499 de1fd9d0682a7c0b7301d02b92a88276f6e50faa
push id28740
push userkwierso@gmail.com
push dateTue, 12 May 2015 23:04:57 +0000
treeherdermozilla-central@de1fd9d0682a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlong
bugs943517
milestone41.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 943517 - Remove the deprecated-sync-thenables from the debugger server;r=jlong
toolkit/devtools/server/actors/script.js
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -13,18 +13,16 @@ const { DebuggerServer } = require("devt
 const DevToolsUtils = require("devtools/toolkit/DevToolsUtils");
 const { dbg_assert, dumpn, update, fetch } = DevToolsUtils;
 const { dirname, joinURI } = require("devtools/toolkit/path");
 const promise = require("promise");
 const PromiseDebugging = require("PromiseDebugging");
 const xpcInspector = require("xpcInspector");
 const ScriptStore = require("./utils/ScriptStore");
 
-const { defer, resolve, reject, all } = require("devtools/toolkit/deprecated-sync-thenables");
-
 loader.lazyGetter(this, "Debugger", () => {
   let Debugger = require("Debugger");
   hackDebugger(Debugger);
   return Debugger;
 });
 loader.lazyRequireGetter(this, "SourceMapConsumer", "source-map", true);
 loader.lazyRequireGetter(this, "SourceMapGenerator", "source-map", true);
 loader.lazyRequireGetter(this, "CssLogic", "devtools/styleinspector/css-logic", true);
@@ -761,17 +759,17 @@ ThreadActor.prototype = {
           return undefined;
         }
 
         packet.frame.where = {
           source: originalLocation.originalSourceActor.form(),
           line: originalLocation.originalLine,
           column: originalLocation.originalColumn
         };
-        resolve(onPacket(packet))
+        Promise.resolve(onPacket(packet))
           .then(null, error => {
             reportError(error);
             return {
               error: "unknownError",
               message: error.message + "\n" + error.stack
             };
           })
           .then(packet => {
@@ -936,18 +934,18 @@ ThreadActor.prototype = {
    * @param Object aRequest
    *        The request packet received over the RDP.
    * @returns A promise that resolves to true once the hooks are attached, or is
    *          rejected with an error packet.
    */
   _handleResumeLimit: function (aRequest) {
     let steppingType = aRequest.resumeLimit.type;
     if (["break", "step", "next", "finish"].indexOf(steppingType) == -1) {
-      return reject({ error: "badParameterType",
-                      message: "Unknown resumeLimit type" });
+      return Promise.reject({ error: "badParameterType",
+                              message: "Unknown resumeLimit type" });
     }
 
     const generatedLocation = this.sources.getFrameLocation(this.youngestFrame);
     return this.sources.getOriginalLocation(generatedLocation)
       .then(originalLocation => {
         const { onEnterFrame, onPop, onStep } = this._makeSteppingHooks(originalLocation,
                                                                         steppingType);
 
@@ -1050,17 +1048,17 @@ ThreadActor.prototype = {
       return this._forceCompletion(aRequest);
     }
 
     let resumeLimitHandled;
     if (aRequest && aRequest.resumeLimit) {
       resumeLimitHandled = this._handleResumeLimit(aRequest)
     } else {
       this._clearSteppingHooks(this.youngestFrame);
-      resumeLimitHandled = resolve(true);
+      resumeLimitHandled = Promise.resolve(true);
     }
 
     return resumeLimitHandled.then(() => {
       if (aRequest) {
         this._options.pauseOnExceptions = aRequest.pauseOnExceptions;
         this._options.ignoreCaughtExceptions = aRequest.ignoreCaughtExceptions;
         this.maybePauseOnExceptions();
         this._maybeListenToEvents(aRequest);
@@ -1312,17 +1310,17 @@ ThreadActor.prototype = {
           line: originalLocation.originalLine,
           column: originalLocation.originalColumn
         };
         form.source = sourceForm;
       });
       promises.push(promise);
     }
 
-    return all(promises).then(function () {
+    return Promise.all(promises).then(function () {
       return { frames: frames };
     });
   },
 
   onReleaseMany: function (aRequest) {
     if (!aRequest.actors) {
       return { error: "missingParameter",
                message: "no actors were specified" };
@@ -1352,18 +1350,18 @@ ThreadActor.prototype = {
     const scripts = this.scripts.getAllScripts();
     for (let i = 0, len = scripts.length; i < len; i++) {
       let s = scripts[i];
       if (s.source) {
         sourcesToScripts.set(s.source, s);
       }
     }
 
-    return all([this.sources.createSourceActors(script.source)
-                for (script of sourcesToScripts.values())]);
+    return Promise.all([this.sources.createSourceActors(script.source)
+                       for (script of sourcesToScripts.values())]);
   },
 
   onSources: function (aRequest) {
     return this._discoverSources().then(() => {
       return {
         sources: [s.form() for (s of this.sources.iter())]
       };
     });
@@ -2505,17 +2503,17 @@ SourceActor.prototype = {
 
     return offsets;
   },
 
   /**
    * Handler for the "source" packet.
    */
   onSource: function () {
-    return resolve(this._init)
+    return Promise.resolve(this._init)
       .then(this._getSourceText)
       .then(({ content, contentType }) => {
         return {
           from: this.actorID,
           source: this.threadActor.createValueGrip(
             content, this.threadActor.threadLifetimePool),
           contentType: contentType
         };