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()); |