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

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

Issue 2819034: Add ES5 Object.isExtensible and Object.preventExtensions. (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') | test/es5conform/es5conform.status » ('j') | 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 5007)
+++ test/cctest/test-api.cc (working copy)
@@ -3335,6 +3335,42 @@
}
+
+THREADED_TEST(ExtensibleOnUndetectable) {
+ v8::HandleScope scope;
+ LocalContext env;
+
+ Local<v8::FunctionTemplate> desc =
+ v8::FunctionTemplate::New(0, v8::Handle<Value>());
+ desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
+
+ Local<v8::Object> obj = desc->GetFunction()->NewInstance();
+ env->Global()->Set(v8_str("undetectable"), obj);
+
+ Local<String> source = v8_str("undetectable.x = 42;"
+ "undetectable.x");
+
+ Local<Script> script = Script::Compile(source);
+
+ CHECK_EQ(v8::Integer::New(42), script->Run());
+
+ ExpectBoolean("Object.isExtensible(undetectable)", true);
+
+ source = v8_str("Object.preventExtensions(undetectable);");
+ script = Script::Compile(source);
+ script->Run();
+ ExpectBoolean("Object.isExtensible(undetectable)", false);
+
+ source = v8_str("undetectable.y = 2000;");
+ script = Script::Compile(source);
+ v8::TryCatch try_catch;
+ Local<Value> result = script->Run();
+ CHECK(result.IsEmpty());
+ CHECK(try_catch.HasCaught());
+}
+
+
+
THREADED_TEST(UndetectableString) {
v8::HandleScope scope;
LocalContext env;
« no previous file with comments | « src/v8natives.js ('k') | test/es5conform/es5conform.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698