mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1055472 - Part 3: Make the Object constructor properly subclassable. (r=Waldo)
This commit is contained in:
parent
298927c7c3
commit
cc367ad748
@ -33,7 +33,12 @@ js::obj_construct(JSContext* cx, unsigned argc, Value* vp)
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
RootedObject obj(cx, nullptr);
|
||||
if (args.length() > 0 && !args[0].isNullOrUndefined()) {
|
||||
if (args.isConstructing() && (&args.newTarget().toObject() != &args.callee())) {
|
||||
RootedObject newTarget(cx, &args.newTarget().toObject());
|
||||
obj = CreateThis(cx, &PlainObject::class_, newTarget);
|
||||
if (!obj)
|
||||
return false;
|
||||
} else if (args.length() > 0 && !args[0].isNullOrUndefined()) {
|
||||
obj = ToObject(cx, args[0]);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
@ -16,6 +16,7 @@ function testBuiltin(builtin) {
|
||||
|
||||
|
||||
testBuiltin(Function);
|
||||
testBuiltin(Object);
|
||||
|
||||
`;
|
||||
|
||||
|
@ -53,8 +53,6 @@ testBase(p);
|
||||
handler.construct = (target, args, nt) => Reflect.construct(target, args, nt);
|
||||
testBase(p);
|
||||
|
||||
// Object will have to wait for fixed builtins.
|
||||
|
||||
`;
|
||||
|
||||
if (classesEnabled())
|
||||
|
Loading…
Reference in New Issue
Block a user