Commit 25ca62b6 authored by adamk@chromium.org's avatar adamk@chromium.org

HasRealIndexedProperty doesn't work on JSGlobalProxy

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

BUG=257748
R=adamk@chromium.org, rossberg@chromium.org

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

Patch from Adam Barth <abarth@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15610 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 695b18c0
......@@ -3243,7 +3243,6 @@ void JSObject::LocalLookupRealNamedProperty(Name* name, LookupResult* result) {
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);
}
......@@ -12821,6 +12820,13 @@ bool JSObject::HasRealElementProperty(Isolate* isolate, uint32_t index) {
}
}
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;
}
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment