зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1055472 - Part 3: Make the Object constructor properly subclassable. (r=Waldo)
This commit is contained in:
Родитель
272134a803
Коммит
9819f5299e
|
@ -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())
|
||||
|
|
Загрузка…
Ссылка в новой задаче