Bug 1121318 - Cleanup formatting in HelperApps.jsm r=rnewman
authorMark Finkle <mfinkle@mozilla.com>
Wed, 14 Jan 2015 08:24:58 -0500
changeset 223687 7b853be9e11875e127333359d9f8bc77da27f0bd
parent 223686 b0ee8d61158afd32e643ff3c67a75629f175556d
child 223688 c379987d02661ae5fb5d926d6ed3a04df38df490
push id10810
push usermfinkle@mozilla.com
push dateWed, 14 Jan 2015 13:26:38 +0000
treeherderfx-team@c379987d0266 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1121318
milestone38.0a1
Bug 1121318 - Cleanup formatting in HelperApps.jsm r=rnewman
mobile/android/modules/HelperApps.jsm
--- a/mobile/android/modules/HelperApps.jsm
+++ b/mobile/android/modules/HelperApps.jsm
@@ -105,19 +105,19 @@ var HelperApps =  {
   getAppsForUri: function getAppsForUri(uri, flags = { }, callback) {
     flags.filterBrowsers = "filterBrowsers" in flags ? flags.filterBrowsers : true;
     flags.filterHtml = "filterHtml" in flags ? flags.filterHtml : true;
 
     // Query for apps that can/can't handle the mimetype
     let msg = this._getMessage("Intent:GetHandlers", uri, flags);
     let parseData = (d) => {
       let apps = []
-
-      if (!d)
+      if (!d) {
         return apps;
+      }
 
       apps = this._parseApps(d.apps);
 
       if (flags.filterBrowsers) {
         apps = apps.filter((app) => {
           return app.name && !this.defaultBrowsers[app.name];
         });
       }
@@ -135,18 +135,16 @@ var HelperApps =  {
         }
       }
 
       return apps;
     };
 
     if (!callback) {
       let data = this._sendMessageSync(msg);
-      if (!data)
-        return [];
       return parseData(data);
     } else {
       Messaging.sendRequestForResult(msg).then(function(data) {
         callback(parseData(data));
       });
     }
   },
 
@@ -168,19 +166,20 @@ var HelperApps =  {
                  "activityName" : appInfo[i+3]}));
     }
 
     return apps;
   },
 
   _getMessage: function(type, uri, options = {}) {
     let mimeType = options.mimeType;
-    if (uri && mimeType == undefined)
+    if (uri && mimeType == undefined) {
       mimeType = ContentAreaUtils.getMIMETypeForURI(uri) || "";
-      
+    }
+
     return {
       type: type,
       mime: mimeType,
       action: options.action || "", // empty action string defaults to android.intent.action.VIEW
       url: uri ? uri.spec : "",
       packageName: options.packageName || "",
       className: options.className || ""
     };
@@ -206,14 +205,15 @@ var HelperApps =  {
 
   _sendMessageSync: function(msg) {
     let res = null;
     Messaging.sendRequestForResult(msg).then(function(data) {
       res = data;
     });
 
     let thread = Services.tm.currentThread;
-    while (res == null)
+    while (res == null) {
       thread.processNextEvent(true);
+    }
 
     return res;
   },
 };