Bug 1317389: Change property attributes for generator and async functions to match ES2015/2017.

Tag #1287
This commit is contained in:
Gaming4JC 2019-12-04 22:11:58 -05:00 committed by Roy Tam
commit 22cd310e82
6 changed files with 209 additions and 12 deletions

View file

@ -586,17 +586,18 @@ GlobalObject::createBlankPrototypeInheriting(JSContext* cx, Handle<GlobalObject*
}
bool
js::LinkConstructorAndPrototype(JSContext* cx, JSObject* ctor_, JSObject* proto_)
js::LinkConstructorAndPrototype(JSContext* cx, JSObject* ctor_, JSObject* proto_,
unsigned prototypeAttrs, unsigned constructorAttrs)
{
RootedObject ctor(cx, ctor_), proto(cx, proto_);
RootedValue protoVal(cx, ObjectValue(*proto));
RootedValue ctorVal(cx, ObjectValue(*ctor));
return DefineProperty(cx, ctor, cx->names().prototype, protoVal,
nullptr, nullptr, JSPROP_PERMANENT | JSPROP_READONLY) &&
DefineProperty(cx, proto, cx->names().constructor, ctorVal,
nullptr, nullptr, 0);
return DefineProperty(cx, ctor, cx->names().prototype, protoVal, nullptr, nullptr,
prototypeAttrs) &&
DefineProperty(cx, proto, cx->names().constructor, ctorVal, nullptr, nullptr,
constructorAttrs);
}
bool