Bug 989109 - Return isDebuggable using new async callback. r=wesj, a=lsblakk
authorMyk Melez <myk@mozilla.org>
Tue, 01 Apr 2014 15:38:01 -0700
changeset 191580 3cfbc5ffa9681516b70ecb7562e21449c152dbcf
parent 191579 d40fdf71320e0c33390465560bf4cba11ddf6933
child 191581 760e01dafd959a595c74b12eb7ce3d5ff3e29e14
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj, lsblakk
bugs989109
milestone30.0a2
Bug 989109 - Return isDebuggable using new async callback. r=wesj, a=lsblakk
mobile/android/base/GeckoApp.java
mobile/android/chrome/content/WebappRT.js
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -716,17 +716,17 @@ public abstract class GeckoApp
 
                                 EventDispatcher.sendResponse(originalMessage, response);
                             }
                         });
             } else if (event.equals("Locale:Set")) {
                 setLocale(message.getString("locale"));
             } else if (event.equals("NativeApp:IsDebuggable")) {
                 JSONObject ret = new JSONObject();
-                ret.put("isDebuggable", getIsDebuggable() ? "true" : "false");
+                ret.put("isDebuggable", getIsDebuggable());
                 EventDispatcher.sendResponse(message, ret);
             } else if (event.equals("SystemUI:Visibility")) {
                 setSystemUiVisible(message.getBoolean("visible"));
             }
         } catch (Exception e) {
             Log.e(LOGTAG, "Exception handling message \"" + event + "\":", e);
         }
     }
--- a/mobile/android/chrome/content/WebappRT.js
+++ b/mobile/android/chrome/content/WebappRT.js
@@ -62,21 +62,21 @@ let WebappRT = {
         if (aManifest) {
           PermissionsInstaller.installPermissions(aApp, true);
         }
       });
     }
 
 #ifdef MOZ_ANDROID_SYNTHAPKS
     // If the app is in debug mode, configure and enable the remote debugger.
-    // sendMessageToJava can only return string values, so it returns the string
-    // "true" rather than boolean true if the app is in debug mode.
-    if (sendMessageToJava({ type: "NativeApp:IsDebuggable" }) === "true") {
-      this._enableRemoteDebugger(aUrl);
-    }
+    sendMessageToJava({ type: "NativeApp:IsDebuggable" }, (response) => {
+      if (response.isDebuggable) {
+        this._enableRemoteDebugger(aUrl);
+      }
+    });
 #endif
 
     this.findManifestUrlFor(aUrl, aCallback);
   },
 
   getManifestFor: function (aUrl, aCallback) {
     DOMApplicationRegistry.registryReady.then(() => {
       let request = navigator.mozApps.mgmt.getAll();