1
0
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:
Robert Krimen 2013-06-15 11:44:29 -07:00
parent 22ae900958
commit 14b2fb3918
3 changed files with 9 additions and 4 deletions

6
inline
View File

@ -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 (@_) {

View File

@ -571,7 +571,7 @@ func _newContext(runtime *_runtime) {
},
},
"prototype": _property{
mode: 0100,
mode: 0,
value: Value{
_valueType: valueObject,
value: runtime.Global.ObjectPrototype,

View File

@ -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) {