mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-28 10:07:30 +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,
|
ModuleNamespaceObject::ProxyHandler::setPrototype(JSContext* cx, HandleObject proxy,
|
||||||
HandleObject proto, ObjectOpResult& result) const
|
HandleObject proto, ObjectOpResult& result) const
|
||||||
{
|
{
|
||||||
|
if (!proto)
|
||||||
|
return result.succeed();
|
||||||
return result.failCantSetProto();
|
return result.failCantSetProto();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,9 @@ assertEq(getModuleEnvironmentValue(b, "x"), 3);
|
||||||
|
|
||||||
// Test module namespace internal methods as defined in 9.4.6
|
// Test module namespace internal methods as defined in 9.4.6
|
||||||
assertEq(Object.getPrototypeOf(ns), null);
|
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);
|
assertThrowsInstanceOf(function() { ns.foo = 1; }, TypeError);
|
||||||
assertEq(Object.isExtensible(ns), false);
|
assertEq(Object.isExtensible(ns), false);
|
||||||
Object.preventExtensions(ns);
|
Object.preventExtensions(ns);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue