Bug 1196975 - part4: waiveInterposition. r=billm

This commit is contained in:
Gabor Krizsanits 2015-11-05 12:05:56 +01:00
Родитель 7b48983873
Коммит b0e22ea0ea
4 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -1025,6 +1025,7 @@ xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, nsISupports* prin
priv->allowWaivers = options.allowWaivers;
priv->writeToGlobalPrototype = options.writeToGlobalPrototype;
priv->isWebExtensionContentScript = options.isWebExtensionContentScript;
priv->waiveInterposition = options.waiveInterposition;
// Set up the wantXrays flag, which indicates whether xrays are desired even
// for same-origin access.
@ -1491,6 +1492,7 @@ SandboxOptions::Parse()
ParseBoolean("wantComponents", &wantComponents) &&
ParseBoolean("wantExportHelpers", &wantExportHelpers) &&
ParseBoolean("isWebExtensionContentScript", &isWebExtensionContentScript) &&
ParseBoolean("waiveInterposition", &waiveInterposition) &&
ParseString("sandboxName", sandboxName) &&
ParseObject("sameZoneAs", &sameZoneAs) &&
ParseBoolean("freshZone", &freshZone) &&

Просмотреть файл

@ -194,6 +194,7 @@ CompartmentPrivate::CompartmentPrivate(JSCompartment* c)
, writeToGlobalPrototype(false)
, skipWriteToGlobalPrototype(false)
, isWebExtensionContentScript(false)
, waiveInterposition(false)
, universalXPConnectEnabled(false)
, forcePermissiveCOWs(false)
, scriptability(c)

Просмотреть файл

@ -139,9 +139,11 @@ XPCWrappedNativeScope::XPCWrappedNativeScope(JSContext* cx,
JSAddonId* addonId = JS::AddonIdOfObject(aGlobal);
if (gInterpositionMap) {
bool isSystem = nsContentUtils::IsSystemPrincipal(principal);
if (InterpositionMap::Ptr p = gInterpositionMap->lookup(addonId)) {
bool waiveInterposition = priv->waiveInterposition;
InterpositionMap::Ptr interposition = gInterpositionMap->lookup(addonId);
if (!waiveInterposition && interposition) {
MOZ_RELEASE_ASSERT(isSystem);
mInterposition = p->value();
mInterposition = interposition->value();
}
// We also want multiprocessCompatible add-ons to have a default interposition.
if (!mInterposition && addonId && isSystem) {

Просмотреть файл

@ -3475,6 +3475,7 @@ public:
, wantComponents(true)
, wantExportHelpers(false)
, isWebExtensionContentScript(false)
, waiveInterposition(false)
, proto(cx)
, addonId(cx)
, writeToGlobalPrototype(false)
@ -3492,6 +3493,7 @@ public:
bool wantComponents;
bool wantExportHelpers;
bool isWebExtensionContentScript;
bool waiveInterposition;
JS::RootedObject proto;
nsCString sandboxName;
JS::RootedString addonId;
@ -3732,6 +3734,11 @@ public:
// various bits of special compatibility behavior.
bool isWebExtensionContentScript;
// Even if an add-on needs interposition, it does not necessary need it
// for every scope. If this flag is set we waive interposition for this
// scope.
bool waiveInterposition;
// This is only ever set during mochitest runs when enablePrivilege is called.
// It's intended as a temporary stopgap measure until we can finish ripping out
// enablePrivilege. Once set, this value is never unset (i.e., it doesn't follow