From 14b2fb39187611b174596d2c38668a39101496bc Mon Sep 17 00:00:00 2001 From: Robert Krimen Date: Sat, 15 Jun 2013 11:44:29 -0700 Subject: [PATCH] Fix writable/enumerable/configurable of Object.prototype to be false --- inline | 6 +++++- inline.go | 2 +- object_test.go | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/inline b/inline index 9a90236..f8f1eda 100755 --- a/inline +++ b/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 (@_) { diff --git a/inline.go b/inline.go index 4f1bb7f..eca106a 100644 --- a/inline.go +++ b/inline.go @@ -571,7 +571,7 @@ func _newContext(runtime *_runtime) { }, }, "prototype": _property{ - mode: 0100, + mode: 0, value: Value{ _valueType: valueObject, value: runtime.Global.ObjectPrototype, diff --git a/object_test.go b/object_test.go index 87a3cc6..d6b8af2 100644 --- a/object_test.go +++ b/object_test.go @@ -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) {