Bug 1393150 Fix isParentProcess() logic draft
authorAndrew Swan <aswan@mozilla.com>
Thu, 13 Jul 2017 21:53:59 -0700
changeset 651913 9b7651db69528ef0bb38fe62955d48d21b101ac1
parent 608658 67cd1ee26f2661fa5efe3d952485ab3c89af4271
child 727911 80f9860b987279f8d1655594b9decc05cf6ab8f8
push id75864
push useraswan@mozilla.com
push dateThu, 24 Aug 2017 06:50:20 +0000
bugs1393150
milestone56.0a1
Bug 1393150 Fix isParentProcess() logic MozReview-Commit-ID: 5dpg21Y69Uk
toolkit/components/extensions/ExtensionPolicyService.cpp
--- a/toolkit/components/extensions/ExtensionPolicyService.cpp
+++ b/toolkit/components/extensions/ExtensionPolicyService.cpp
@@ -80,21 +80,24 @@ ExtensionPolicyService::ExtensionPolicyS
 
   RegisterObservers();
 }
 
 
 bool
 ExtensionPolicyService::IsExtensionProcess() const
 {
-  if (sRemoteExtensions && XRE_IsContentProcess()) {
-    auto& remoteType = dom::ContentChild::GetSingleton()->GetRemoteType();
-    return remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE);
+  if (!sRemoteExtensions) {
+    return XRE_IsParentProcess();
   }
-  return XRE_IsParentProcess();
+  if (!XRE_IsContentProcess()) {
+    return false;
+  }
+  auto& remoteType = dom::ContentChild::GetSingleton()->GetRemoteType();
+  return remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE);
 }
 
 
 WebExtensionPolicy*
 ExtensionPolicyService::GetByURL(const URLInfo& aURL)
 {
   if (aURL.Scheme() == nsGkAtoms::moz_extension) {
     return GetByHost(aURL.Host());