mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
Bug 1326453 - Part 3: Don't throw a TypeError when SetPrototypeOf for module namespace objects is called with null
This commit is contained in:
parent
307c8cb570
commit
50765b944e
2 changed files with 5 additions and 1 deletions
|
|
@ -345,6 +345,8 @@ bool
|
|||
ModuleNamespaceObject::ProxyHandler::setPrototype(JSContext* cx, HandleObject proxy,
|
||||
HandleObject proto, ObjectOpResult& result) const
|
||||
{
|
||||
if (!proto)
|
||||
return result.succeed();
|
||||
return result.failCantSetProto();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ assertEq(getModuleEnvironmentValue(b, "x"), 3);
|
|||
|
||||
// Test module namespace internal methods as defined in 9.4.6
|
||||
assertEq(Object.getPrototypeOf(ns), null);
|
||||
assertThrowsInstanceOf(() => Object.setPrototypeOf(ns, null), TypeError);
|
||||
assertEq(Reflect.setPrototypeOf(ns, null), true);
|
||||
assertEq(Reflect.setPrototypeOf(ns, Object.prototype), false);
|
||||
assertThrowsInstanceOf(() => Object.setPrototypeOf(ns, {}), TypeError);
|
||||
assertThrowsInstanceOf(function() { ns.foo = 1; }, TypeError);
|
||||
assertEq(Object.isExtensible(ns), false);
|
||||
Object.preventExtensions(ns);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue