Revision: 15610
Author:   [email protected]
Date:     Wed Jul 10 12:03:58 2013
Log:      HasRealIndexedProperty doesn't work on JSGlobalProxy

HasRealIndexedProperty didn't unwrap the JSGlobalProxy and therefore always
returned false.

BUG=257748
[email protected], [email protected]

Review URL: https://codereview.chromium.org/18402007

Patch from Adam Barth <[email protected]>.
http://code.google.com/p/v8/source/detail?r=15610

Modified:
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/src/objects.cc      Wed Jul 10 05:19:37 2013
+++ /branches/bleeding_edge/src/objects.cc      Wed Jul 10 12:03:58 2013
@@ -3243,7 +3243,6 @@
     Object* proto = GetPrototype();
     if (proto->IsNull()) return result->NotFound();
     ASSERT(proto->IsJSGlobalObject());
-    // A GlobalProxy's prototype should always be a proper JSObject.
return JSObject::cast(proto)->LocalLookupRealNamedProperty(name, result);
   }

@@ -12820,6 +12819,13 @@
       return false;
     }
   }
+
+  if (IsJSGlobalProxy()) {
+    Object* proto = GetPrototype();
+    if (proto->IsNull()) return false;
+    ASSERT(proto->IsJSGlobalObject());
+    return JSObject::cast(proto)->HasRealElementProperty(isolate, index);
+  }

return GetElementAttributeWithoutInterceptor(this, index, false) != ABSENT;
 }
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc     Sun Jul  7 04:42:30 2013
+++ /branches/bleeding_edge/test/cctest/test-api.cc     Wed Jul 10 12:03:58 2013
@@ -2338,6 +2338,16 @@
   global->SetInternalField(0, v8_num(17));
   CHECK_EQ(17, global->GetInternalField(0)->Int32Value());
 }
+
+
+THREADED_TEST(GlobalObjectHasRealIndexedProperty) {
+  LocalContext env;
+  v8::HandleScope scope(v8::Isolate::GetCurrent());
+
+  v8::Local<v8::Object> global = env->Global();
+  global->Set(0, v8::String::New("value"));
+  CHECK(global->HasRealIndexedProperty(0));
+}


 static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj,

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to