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

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

Issue 12328064: Remove duplication and unnecessary HandleScope from HasElement helper functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added test for StringWithCharacterAt Created 7 years, 10 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/objects.cc ('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
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 7dd9fc7889d8e2806a763b5251f2b4d13a71b2a5..9ace76e7e7921c10db8f08d2b21b31d47c3d16d5 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -17176,6 +17176,27 @@ TEST(HasOwnProperty) {
}
+TEST(IndexedInterceptorWithStringProto) {
+ v8::HandleScope scope;
+ Handle<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->SetIndexedPropertyHandler(NULL,
+ NULL,
+ HasOwnPropertyIndexedPropertyQuery);
+ LocalContext context;
+ context->Global()->Set(v8_str("obj"), templ->NewInstance());
+ CompileRun("var s = new String('foobar'); obj.__proto__ = s;");
+ // These should be intercepted.
+ CHECK(CompileRun("42 in obj")->BooleanValue());
+ CHECK(CompileRun("'42' in obj")->BooleanValue());
+ // These should fall through to the String prototype.
+ CHECK(CompileRun("0 in obj")->BooleanValue());
+ CHECK(CompileRun("'0' in obj")->BooleanValue());
+ // And these should both fail.
+ CHECK(!CompileRun("32 in obj")->BooleanValue());
+ CHECK(!CompileRun("'32' in obj")->BooleanValue());
+}
+
+
void CheckCodeGenerationAllowed() {
Handle<Value> result = CompileRun("eval('42')");
CHECK_EQ(42, result->Int32Value());
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698