Reviewers: Erik Corry,

Description:
Add test of internal fields on global objects.  This test currently
fails on the partial snapshots branch.

Please review this at http://codereview.chromium.org/660169

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     test/cctest/test-api.cc


Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc     (revision 3959)
+++ test/cctest/test-api.cc     (working copy)
@@ -1334,6 +1334,21 @@
 }


+THREADED_TEST(GlobalObjectInternalFields) {
+  v8::HandleScope scope;
+  Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
+  global_template->SetInternalFieldCount(1);
+  LocalContext env(NULL, global_template);
+  v8::Handle<v8::Object> global_proxy = env->Global();
+  v8::Handle<v8::Object> global =
+      v8::Handle<v8::Object>::Cast(global_proxy->GetPrototype());
+  CHECK_EQ(1, global->InternalFieldCount());
+  CHECK(global->GetInternalField(0)->IsUndefined());
+  global->SetInternalField(0, v8_num(17));
+  CHECK_EQ(17, global->GetInternalField(0)->Int32Value());
+}
+
+
 THREADED_TEST(InternalFieldsNativePointers) {
   v8::HandleScope scope;
   LocalContext env;


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to