Bug 1057155 - Stop error on remote runtime cancel. r=paul
authorJ. Ryan Stinnett <jryans@gmail.com>
Fri, 22 Aug 2014 11:52:06 -0700
changeset 201221 c3cc191aafbd2429441939c25f494a8576c7a83f
parent 200973 e03842f0980f0144c1bee714fd250832c4fecb5e
child 201222 fd9c52c35d50d65da7b41d62aad534f9e8963c55
push id27365
push userryanvm@gmail.com
push dateMon, 25 Aug 2014 15:24:30 +0000
treeherdermozilla-central@23c70481ed91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaul
bugs1057155
milestone34.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 1057155 - Stop error on remote runtime cancel. r=paul
browser/devtools/webide/content/webide.js
browser/devtools/webide/modules/app-manager.js
browser/devtools/webide/modules/runtimes.js
--- a/browser/devtools/webide/content/webide.js
+++ b/browser/devtools/webide/content/webide.js
@@ -241,18 +241,21 @@ let UI = {
     this._busyOperationDescription = operationDescription;
     this.setupBusyTimeout();
     this.busy();
     promise.then(() => {
       this.cancelBusyTimeout();
       this.unbusy();
     }, (e) => {
       this.cancelBusyTimeout();
-      UI.reportError("error_operationFail", operationDescription);
-      console.error(e);
+      let operationCanceled = e && e.canceled;
+      if (!operationCanceled) {
+        UI.reportError("error_operationFail", operationDescription);
+        console.error(e);
+      }
       this.unbusy();
     });
     return promise;
   },
 
   reportError: function(l10nProperty, ...l10nArgs) {
     let text;
 
--- a/browser/devtools/webide/modules/app-manager.js
+++ b/browser/devtools/webide/modules/app-manager.js
@@ -332,17 +332,17 @@ exports.AppManager = AppManager = {
           deferred.reject();
         }
       }
       this.connection.on(Connection.Events.CONNECTED, onConnectedOrDisconnected);
       this.connection.on(Connection.Events.DISCONNECTED, onConnectedOrDisconnected);
       try {
         this.selectedRuntime.connect(this.connection).then(
           () => {},
-          () => {deferred.reject()});
+          deferred.reject.bind(deferred));
       } catch(e) {
         console.error(e);
         deferred.reject();
       }
     }, deferred.reject);
 
     return deferred.promise;
   },
--- a/browser/devtools/webide/modules/runtimes.js
+++ b/browser/devtools/webide/modules/runtimes.js
@@ -121,21 +121,23 @@ let gLocalRuntime = {
 
 let gRemoteRuntime = {
   connect: function(connection) {
     let win = Services.wm.getMostRecentWindow("devtools:webide");
     if (!win) {
       return promise.reject();
     }
     let ret = {value: connection.host + ":" + connection.port};
-    Services.prompt.prompt(win,
-                           Strings.GetStringFromName("remote_runtime_promptTitle"),
-                           Strings.GetStringFromName("remote_runtime_promptMessage"),
-                           ret, null, {});
+    let title = Strings.GetStringFromName("remote_runtime_promptTitle");
+    let message = Strings.GetStringFromName("remote_runtime_promptMessage");
+    let ok = Services.prompt.prompt(win, title, message, ret, null, {});
     let [host,port] = ret.value.split(":");
+    if (!ok) {
+      return promise.reject({canceled: true});
+    }
     if (!host || !port) {
       return promise.reject();
     }
     connection.host = host;
     connection.port = port;
     connection.connect();
     return promise.resolve();
   },