Bug 1312164 - Stop checking for apps with isolated mozbrowser. r=Ehsan draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Sun, 23 Oct 2016 18:16:39 -0500
changeset 428459 facb476bd21986c92e90d0db99e37ed3a48dc5e4
parent 428413 a9a41b69f3f9be494ae0653601c08aa388d9afe4
child 534732 69b762ed666e3e12f28b0c2177b96898c58522cc
push id33307
push userbmo:jryans@gmail.com
push dateMon, 24 Oct 2016 00:29:01 +0000
reviewersEhsan
bugs1312164
milestone52.0a1
Bug 1312164 - Stop checking for apps with isolated mozbrowser. r=Ehsan Since the apps service always returns error codes now, there's no need to ask if any apps are installed prior to allowing non-isolated mozbrowser frames. This change prevents an error from being logged due to the thrown exception from the apps service. MozReview-Commit-ID: DbD960jo0wB
dom/base/nsFrameLoader.cpp
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -1791,53 +1791,16 @@ nsFrameLoader::OwnerIsIsolatedMozBrowser
     return false;
   }
 
   bool isolated = browserFrame->GetIsolated();
   if (isolated) {
     return true;
   }
 
-  // After bug 1238160, which allows isolation to be disabled on mozbrowser
-  // frames, we no longer have a way to tell from the principal alone if
-  // something "is a mozbrowser".  Instead, we now only know "is an isolated
-  // mozbrowser".  The following code paths would return invalid results if it
-  // were possible to have apps *and* isolation could be disabled:
-  //   * CheckPermission in AppProcessChecker.cpp
-  //   * nsScriptSecurityManager::AppStatusForPrincipal
-  //   * init() in SystemMessageManager.js
-  // Currently, desktop is the only platform where we intend to disable
-  // isolation on a browser frame, so non-desktop should be able to assume that
-  // inIsolatedMozBrowser is true for all mozbrowser frames.  To enforce these
-  // assumptions, we assert that there are no apps installed if we have tried
-  // to disable isolation.
-  nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
-  if (!appsService) {
-    // If the apps service is not present, we assume this means there can't be
-    // any apps at all, so there is no problem.
-    return false;
-  }
-  bool appsInstalled;
-  nsresult rv = appsService->AreAnyAppsInstalled(&appsInstalled);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    // The apps service exists, but it threw an error when checking if there are
-    // any apps, so we don't know if we have them or not.
-    return false;
-  }
-#ifdef MOZ_B2G
-  MOZ_RELEASE_ASSERT(!appsInstalled,
-                     "Disabling mozbrowser isolation is not currently "
-                     "allowed when apps are installed.");
-#else
-  if (appsInstalled) {
-    NS_WARNING("Disabling mozbrowser isolation is not currently allowed when "
-               "apps are installed.");
-  }
-#endif
-
   return false;
 }
 
 void
 nsFrameLoader::GetOwnerAppManifestURL(nsAString& aOut)
 {
   aOut.Truncate();
   nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);