mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1052139 - Make more parts of the global object's prototype chain immutable, when we flip that switch. r=bz
This commit is contained in:
parent
9e771cf7d6
commit
11a4e72a00
@ -3111,6 +3111,14 @@ CreateGlobal(JSContext* aCx, T* aNative, nsWrapperCache* aCache,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool succeeded;
|
||||||
|
if (!JS_SetImmutablePrototype(aCx, aGlobal, &succeeded)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
MOZ_ASSERT(succeeded,
|
||||||
|
"making a fresh global object's [[Prototype]] immutable can "
|
||||||
|
"internally fail, but it should never be unsuccessful");
|
||||||
|
|
||||||
return proto;
|
return proto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2953,9 +2953,32 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
|||||||
else:
|
else:
|
||||||
unforgeableHolderSetup = None
|
unforgeableHolderSetup = None
|
||||||
|
|
||||||
|
if (self.descriptor.interface.isOnGlobalProtoChain() and
|
||||||
|
needInterfacePrototypeObject):
|
||||||
|
makeProtoPrototypeImmutable = CGGeneric(fill(
|
||||||
|
"""
|
||||||
|
if (*${protoCache}) {
|
||||||
|
bool succeeded;
|
||||||
|
JS::Handle<JSObject*> prot = GetProtoObjectHandle(aCx, aGlobal);
|
||||||
|
if (!JS_SetImmutablePrototype(aCx, prot, &succeeded)) {
|
||||||
|
$*{failureCode}
|
||||||
|
}
|
||||||
|
|
||||||
|
MOZ_ASSERT(succeeded,
|
||||||
|
"making a fresh prototype object's [[Prototype]] "
|
||||||
|
"immutable can internally fail, but it should "
|
||||||
|
"never be unsuccessful");
|
||||||
|
}
|
||||||
|
""",
|
||||||
|
protoCache=protoCache,
|
||||||
|
failureCode=failureCode))
|
||||||
|
else:
|
||||||
|
makeProtoPrototypeImmutable = None
|
||||||
|
|
||||||
return CGList(
|
return CGList(
|
||||||
[getParentProto, CGGeneric(getConstructorProto), initIds,
|
[getParentProto, CGGeneric(getConstructorProto), initIds,
|
||||||
prefCache, CGGeneric(call), defineAliases, unforgeableHolderSetup],
|
prefCache, CGGeneric(call), defineAliases, unforgeableHolderSetup,
|
||||||
|
makeProtoPrototypeImmutable],
|
||||||
"\n").define()
|
"\n").define()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1056,6 +1056,13 @@ CreateObjectPrototype(JSContext* cx, JSProtoKey key)
|
|||||||
if (!objectProto)
|
if (!objectProto)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
bool succeeded;
|
||||||
|
if (!SetImmutablePrototype(cx, objectProto, &succeeded))
|
||||||
|
return nullptr;
|
||||||
|
MOZ_ASSERT(succeeded,
|
||||||
|
"should have been able to make a fresh Object.prototype's "
|
||||||
|
"[[Prototype]] immutable");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The default 'new' type of Object.prototype is required by type inference
|
* The default 'new' type of Object.prototype is required by type inference
|
||||||
* to have unknown properties, to simplify handling of e.g. heterogenous
|
* to have unknown properties, to simplify handling of e.g. heterogenous
|
||||||
|
Loading…
Reference in New Issue
Block a user