зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1196975 - part4: waiveInterposition. r=billm
This commit is contained in:
Родитель
7b48983873
Коммит
b0e22ea0ea
|
@ -1025,6 +1025,7 @@ xpc::CreateSandboxObject(JSContext* cx, MutableHandleValue vp, nsISupports* prin
|
||||||
priv->allowWaivers = options.allowWaivers;
|
priv->allowWaivers = options.allowWaivers;
|
||||||
priv->writeToGlobalPrototype = options.writeToGlobalPrototype;
|
priv->writeToGlobalPrototype = options.writeToGlobalPrototype;
|
||||||
priv->isWebExtensionContentScript = options.isWebExtensionContentScript;
|
priv->isWebExtensionContentScript = options.isWebExtensionContentScript;
|
||||||
|
priv->waiveInterposition = options.waiveInterposition;
|
||||||
|
|
||||||
// Set up the wantXrays flag, which indicates whether xrays are desired even
|
// Set up the wantXrays flag, which indicates whether xrays are desired even
|
||||||
// for same-origin access.
|
// for same-origin access.
|
||||||
|
@ -1491,6 +1492,7 @@ SandboxOptions::Parse()
|
||||||
ParseBoolean("wantComponents", &wantComponents) &&
|
ParseBoolean("wantComponents", &wantComponents) &&
|
||||||
ParseBoolean("wantExportHelpers", &wantExportHelpers) &&
|
ParseBoolean("wantExportHelpers", &wantExportHelpers) &&
|
||||||
ParseBoolean("isWebExtensionContentScript", &isWebExtensionContentScript) &&
|
ParseBoolean("isWebExtensionContentScript", &isWebExtensionContentScript) &&
|
||||||
|
ParseBoolean("waiveInterposition", &waiveInterposition) &&
|
||||||
ParseString("sandboxName", sandboxName) &&
|
ParseString("sandboxName", sandboxName) &&
|
||||||
ParseObject("sameZoneAs", &sameZoneAs) &&
|
ParseObject("sameZoneAs", &sameZoneAs) &&
|
||||||
ParseBoolean("freshZone", &freshZone) &&
|
ParseBoolean("freshZone", &freshZone) &&
|
||||||
|
|
|
@ -194,6 +194,7 @@ CompartmentPrivate::CompartmentPrivate(JSCompartment* c)
|
||||||
, writeToGlobalPrototype(false)
|
, writeToGlobalPrototype(false)
|
||||||
, skipWriteToGlobalPrototype(false)
|
, skipWriteToGlobalPrototype(false)
|
||||||
, isWebExtensionContentScript(false)
|
, isWebExtensionContentScript(false)
|
||||||
|
, waiveInterposition(false)
|
||||||
, universalXPConnectEnabled(false)
|
, universalXPConnectEnabled(false)
|
||||||
, forcePermissiveCOWs(false)
|
, forcePermissiveCOWs(false)
|
||||||
, scriptability(c)
|
, scriptability(c)
|
||||||
|
|
|
@ -139,9 +139,11 @@ XPCWrappedNativeScope::XPCWrappedNativeScope(JSContext* cx,
|
||||||
JSAddonId* addonId = JS::AddonIdOfObject(aGlobal);
|
JSAddonId* addonId = JS::AddonIdOfObject(aGlobal);
|
||||||
if (gInterpositionMap) {
|
if (gInterpositionMap) {
|
||||||
bool isSystem = nsContentUtils::IsSystemPrincipal(principal);
|
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);
|
MOZ_RELEASE_ASSERT(isSystem);
|
||||||
mInterposition = p->value();
|
mInterposition = interposition->value();
|
||||||
}
|
}
|
||||||
// We also want multiprocessCompatible add-ons to have a default interposition.
|
// We also want multiprocessCompatible add-ons to have a default interposition.
|
||||||
if (!mInterposition && addonId && isSystem) {
|
if (!mInterposition && addonId && isSystem) {
|
||||||
|
|
|
@ -3475,6 +3475,7 @@ public:
|
||||||
, wantComponents(true)
|
, wantComponents(true)
|
||||||
, wantExportHelpers(false)
|
, wantExportHelpers(false)
|
||||||
, isWebExtensionContentScript(false)
|
, isWebExtensionContentScript(false)
|
||||||
|
, waiveInterposition(false)
|
||||||
, proto(cx)
|
, proto(cx)
|
||||||
, addonId(cx)
|
, addonId(cx)
|
||||||
, writeToGlobalPrototype(false)
|
, writeToGlobalPrototype(false)
|
||||||
|
@ -3492,6 +3493,7 @@ public:
|
||||||
bool wantComponents;
|
bool wantComponents;
|
||||||
bool wantExportHelpers;
|
bool wantExportHelpers;
|
||||||
bool isWebExtensionContentScript;
|
bool isWebExtensionContentScript;
|
||||||
|
bool waiveInterposition;
|
||||||
JS::RootedObject proto;
|
JS::RootedObject proto;
|
||||||
nsCString sandboxName;
|
nsCString sandboxName;
|
||||||
JS::RootedString addonId;
|
JS::RootedString addonId;
|
||||||
|
@ -3732,6 +3734,11 @@ public:
|
||||||
// various bits of special compatibility behavior.
|
// various bits of special compatibility behavior.
|
||||||
bool isWebExtensionContentScript;
|
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.
|
// 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
|
// 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
|
// enablePrivilege. Once set, this value is never unset (i.e., it doesn't follow
|
||||||
|
|
Загрузка…
Ссылка в новой задаче