mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
Fix writable/enumerable/configurable of Object.prototype to be false
This commit is contained in:
parent
22ae900958
commit
14b2fb3918
6
inline
6
inline
|
@ -656,9 +656,13 @@ sub globalFunction {
|
|||
my $builtinNew = "builtinNew${name}";
|
||||
my $prototype = "runtime.Global.${name}Prototype";
|
||||
my $propertyMap = "";
|
||||
my $prototypeMode = "0100";
|
||||
if ($name eq "Object") {
|
||||
$prototypeMode = "0";
|
||||
}
|
||||
unshift @_,
|
||||
$self->property("length", $self->numberValue($length), "0"),
|
||||
$self->property("prototype", $self->objectValue($prototype), "0100"),
|
||||
$self->property("prototype", $self->objectValue($prototype), $prototypeMode);
|
||||
;
|
||||
|
||||
if (@_) {
|
||||
|
|
|
@ -571,7 +571,7 @@ func _newContext(runtime *_runtime) {
|
|||
},
|
||||
},
|
||||
"prototype": _property{
|
||||
mode: 0100,
|
||||
mode: 0,
|
||||
value: Value{
|
||||
_valueType: valueObject,
|
||||
value: runtime.Global.ObjectPrototype,
|
||||
|
|
|
@ -16,8 +16,9 @@ func TestObject_(t *testing.T) {
|
|||
|
||||
test := runTest()
|
||||
test(`
|
||||
typeof Object.prototype;
|
||||
`, "object")
|
||||
var abc = Object.getOwnPropertyDescriptor(Object, "prototype");
|
||||
[ typeof Object.prototype, abc.writable, abc.enumerable, abc.configurable ];
|
||||
`, "object,false,false,false")
|
||||
}
|
||||
|
||||
func TestStringObject(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user