Index: test/cctest/test-accessors.cc |
diff --git a/test/cctest/test-accessors.cc b/test/cctest/test-accessors.cc |
index 0b342ff3d920fd5a4bf91504c082336d9dac8e4c..d44503534fb6b5b4479fd2b37e2d763bfde4f9c5 100644 |
--- a/test/cctest/test-accessors.cc |
+++ b/test/cctest/test-accessors.cc |
@@ -453,3 +453,29 @@ THREADED_TEST(HandleScopeSegment) { |
"result;"))->Run(); |
CHECK_EQ(100, result->Int32Value()); |
} |
+ |
+ |
+v8::Handle<v8::Array> JSONStringifyEnumerator(const AccessorInfo& info) { |
+ v8::Handle<v8::Array> array = v8::Array::New(1); |
+ array->Set(0, v8_str("regress")); |
+ return array; |
+} |
+ |
+ |
+v8::Handle<v8::Value> JSONStringifyGetter(Local<String> name, |
+ const AccessorInfo& info) { |
+ return v8_str("crbug-161028"); |
+} |
+ |
+ |
+THREADED_TEST(JSONStringifyNamedInterceptorObject) { |
+ v8::HandleScope scope; |
+ LocalContext env; |
+ |
+ v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
+ obj->SetNamedPropertyHandler( |
+ JSONStringifyGetter, NULL, NULL, NULL, JSONStringifyEnumerator); |
+ env->Global()->Set(v8_str("obj"), obj->NewInstance()); |
+ v8::Handle<v8::String> expected = v8_str("{\"regress\":\"crbug-161028\"}"); |
+ CHECK(CompileRun("JSON.stringify(obj)")->Equals(expected)); |
+} |