Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Unified Diff: test/cctest/test-api.cc

Issue 2825026: Object.getOwnPropertyNames should be free of duplicates (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 4957)
+++ test/cctest/test-api.cc (working copy)
@@ -5035,6 +5035,31 @@
}
+static v8::Handle<v8::Array> NamedPropertyEnumerator(const AccessorInfo& info) {
+ v8::Handle<v8::Array> result = v8::Array::New(1);
+ result->Set(0, v8_str("x"));
+ return result;
+}
+
+
+THREADED_TEST(GetOwnPropertyNamesWithInterceptor) {
+ v8::HandleScope handle_scope;
+ v8::Handle<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New();
+
+ obj_template->Set(v8_str("x"), v8::Integer::New(42));
+ obj_template->SetNamedPropertyHandler(NULL, NULL, NULL, NULL,
+ NamedPropertyEnumerator);
+
+ LocalContext context;
+ v8::Handle<v8::Object> global = context->Global();
+ global->Set(v8_str("object"), obj_template->NewInstance());
+
+ v8::Handle<Value> value =
+ CompileRun("Object.getOwnPropertyNames(object).join(',')");
+ CHECK_EQ(v8_str("x"), value);
+}
+
+
static v8::Handle<Value> ConstTenGetter(Local<String> name,
const AccessorInfo& info) {
return v8_num(10);
« no previous file with comments | « src/v8natives.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698