Fixing propertyIsEnumerable for properties that are *both* enumerable and read-only.
authorolehougaard <olehougaard@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 31 Oct 2008 11:53:29 +0000 (11:53 +0000)
committerolehougaard <olehougaard@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 31 Oct 2008 11:53:29 +0000 (11:53 +0000)
Review URL: http://codereview.chromium.org/8962

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@670 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/runtime.cc
test/cctest/test-api.cc

index 197aae6..a1d6a9d 100644 (file)
@@ -1934,7 +1934,7 @@ static Object* Runtime_IsPropertyEnumerable(Arguments args) {
   }
 
   PropertyAttributes att = object->GetLocalPropertyAttribute(key);
-  return Heap::ToBoolean(att != ABSENT && att != DONT_ENUM);
+  return Heap::ToBoolean(att != ABSENT && (att & DONT_ENUM) == 0);
 }
 
 
index 1ec3ab9..0e8a508 100644 (file)
@@ -1027,6 +1027,15 @@ THREADED_TEST(PrePropertyHandler) {
 }
 
 
+THREADED_TEST(UndefinedIsNotEnumerable) {
+  v8::HandleScope scope;
+  LocalContext env;
+  v8::Handle<Value> result = Script::Compile(v8_str(
+      "this.propertyIsEnumerable(undefined)"))->Run();
+  CHECK(result->IsFalse());
+}
+
+
 v8::Handle<Script> call_recursively_script;
 static const int kTargetRecursionDepth = 300;  // near maximum