Bug 1393150 prevent remote extensions when e10s is off, r=bz,kmag

MozReview-Commit-ID: HjLLa9vx2UW
This commit is contained in:
Shane Caraveo
2017-09-14 15:12:45 -07:00
parent c87558dd5f
commit 5592e73c3a
8 changed files with 31 additions and 9 deletions

View File

@@ -20,6 +20,7 @@
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsILoadInfo.h"
#include "nsIXULRuntime.h"
#include "nsNetUtil.h"
#include "nsPIDOMWindow.h"
#include "nsXULAppAPI.h"
@@ -81,15 +82,22 @@ ExtensionPolicyService::ExtensionPolicyService()
RegisterObservers();
}
bool
ExtensionPolicyService::UseRemoteExtensions() const
{
return sRemoteExtensions && BrowserTabsRemoteAutostart();
}
bool
ExtensionPolicyService::IsExtensionProcess() const
{
if (sRemoteExtensions && XRE_IsContentProcess()) {
bool isRemote = UseRemoteExtensions();
if (isRemote && XRE_IsContentProcess()) {
auto& remoteType = dom::ContentChild::GetSingleton()->GetRemoteType();
return remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE);
}
return XRE_IsParentProcess();
return !isRemote && XRE_IsParentProcess();
}