Bug 1121318 - Make a fast path for well known internal schemes in HelperApps.getAppsForUri r=rnewman
authorMark Finkle <mfinkle@mozilla.com>
Wed, 14 Jan 2015 08:26:19 -0500
changeset 223688 c379987d02661ae5fb5d926d6ed3a04df38df490
parent 223687 7b853be9e11875e127333359d9f8bc77da27f0bd
child 223753 b8d38d19dbd99363e89f39a42b9d49929ce0c6ba
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 - Make a fast path for well known internal schemes in HelperApps.getAppsForUri r=rnewman
mobile/android/modules/HelperApps.jsm
--- a/mobile/android/modules/HelperApps.jsm
+++ b/mobile/android/modules/HelperApps.jsm
@@ -98,16 +98,24 @@ var HelperApps =  {
         });
       } catch(e) {}
     }
 
     return results;
   },
 
   getAppsForUri: function getAppsForUri(uri, flags = { }, callback) {
+    // Return early for well-known internal schemes
+    if (!uri || uri.schemeIs("about") || uri.schemeIs("chrome")) {
+      if (callback) {
+        callback([]);
+      }
+      return [];
+    }
+
     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) {