зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1512029 part 2 - Some CompartmentPrivate changes for same-compartment realms. r=bzbarsky
Differential Revision: https://phabricator.services.mozilla.com/D14253 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cccc414b7a
Коммит
a87026ec12
|
@ -195,6 +195,7 @@ CompartmentPrivate::CompartmentPrivate(JS::Compartment* c,
|
|||
hasExclusiveExpandos(false),
|
||||
universalXPConnectEnabled(false),
|
||||
forcePermissiveCOWs(false),
|
||||
wasShutdown(false),
|
||||
mWrappedJSMap(JSObject2WrappedJSMap::newMap(XPC_JS_MAP_LENGTH)) {
|
||||
MOZ_COUNT_CTOR(xpc::CompartmentPrivate);
|
||||
mozilla::PodArrayZero(wrapperDenialWarnings);
|
||||
|
@ -206,7 +207,12 @@ CompartmentPrivate::~CompartmentPrivate() {
|
|||
}
|
||||
|
||||
void CompartmentPrivate::SystemIsBeingShutDown() {
|
||||
mWrappedJSMap->ShutdownMarker();
|
||||
// We may call this multiple times when the compartment contains more than one
|
||||
// realm.
|
||||
if (!wasShutdown) {
|
||||
mWrappedJSMap->ShutdownMarker();
|
||||
wasShutdown = true;
|
||||
}
|
||||
}
|
||||
|
||||
RealmPrivate::RealmPrivate(JS::Realm* realm)
|
||||
|
|
|
@ -86,12 +86,14 @@ XPCWrappedNativeScope::XPCWrappedNativeScope(
|
|||
|
||||
nsIPrincipal* principal = GetPrincipal();
|
||||
|
||||
// Create the compartment private.
|
||||
// Create the compartment private if needed.
|
||||
JS::Compartment* c = js::GetObjectCompartment(aGlobal);
|
||||
MOZ_ASSERT(!JS_GetCompartmentPrivate(c));
|
||||
CompartmentPrivate* priv =
|
||||
new CompartmentPrivate(c, BasePrincipal::Cast(principal), aSite);
|
||||
JS_SetCompartmentPrivate(c, priv);
|
||||
if (CompartmentPrivate* priv = CompartmentPrivate::Get(c)) {
|
||||
MOZ_ASSERT(priv->originInfo.IsSameOrigin(principal));
|
||||
} else {
|
||||
priv = new CompartmentPrivate(c, BasePrincipal::Cast(principal), aSite);
|
||||
JS_SetCompartmentPrivate(c, priv);
|
||||
}
|
||||
|
||||
// Attach ourselves to the realm private.
|
||||
Realm* realm = JS::GetObjectRealmOrNull(aGlobal);
|
||||
|
|
|
@ -2807,6 +2807,9 @@ class CompartmentPrivate {
|
|||
// Using it in production is inherently unsafe.
|
||||
bool forcePermissiveCOWs;
|
||||
|
||||
// Whether SystemIsBeingShutDown has been called on this compartment.
|
||||
bool wasShutdown;
|
||||
|
||||
// Whether we've emitted a warning about a property that was filtered out
|
||||
// by a security wrapper. See XrayWrapper.cpp.
|
||||
bool wrapperDenialWarnings[WrapperDenialTypeCount];
|
||||
|
|
Загрузка…
Ссылка в новой задаче