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 197aae6079682e54e10b7b1eb4fdfc18d7162126..a1d6a9d01bce9a354efe799128b3079ae6f4748f 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 1ec3ab97971515d8ce2abfe2bc4d37f9536a31d7..0e8a508af822ca5f0a342ff84745ddbb99b4a7d8 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