Reviewers: adamk, Sven Panne,
Description:
HasRealIndexedProperty doesn't work on JSGlobalProxy
HasRealIndexedProperty didn't unwrap the JSGlobalProxy and therefore always
returned false.
BUG=257748
[email protected],[email protected]
Please review this at https://codereview.chromium.org/18402007/
SVN Base: https://chromium.googlesource.com/external/v8.git@master
Affected files:
M src/objects.cc
M test/cctest/test-api.cc
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
2611b57aef1a6aae6f9efa3b137fab0a717d91c0..4031c5c41663e21c60a041f57529a31d34088a9f
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12836,6 +12836,14 @@ bool JSObject::HasRealElementProperty(Isolate*
isolate, uint32_t index) {
}
}
+ if (IsJSGlobalProxy()) {
+ Object* proto = GetPrototype();
+ if (proto->IsNull()) return false;
+ ASSERT(proto->IsJSGlobalObject());
+ // A GlobalProxy's prototype should always be a proper JSObject.
+ return JSObject::cast(proto)->HasRealElementProperty(isolate, index);
+ }
+
return GetElementAttributeWithoutInterceptor(this, index, false) !=
ABSENT;
}
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
f8f1930285663cc05eabec606733c29b40de2b9b..406d4048a880a7bf8ce506f9a9319d9128930d17
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -2340,6 +2340,16 @@ THREADED_TEST(GlobalObjectInternalFields) {
}
+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,
void* value) {
CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1));
--
--
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.