 Chromium Code Reviews
 Chromium Code Reviews Issue 116533003:
  Avoid duplication of a hidden & inherited prototype's properties.  (Closed) 
  Base URL: git://github.com/v8/v8.git@bleeding_edge
    
  
    Issue 116533003:
  Avoid duplication of a hidden & inherited prototype's properties.  (Closed) 
  Base URL: git://github.com/v8/v8.git@bleeding_edge| Index: test/cctest/test-api.cc | 
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc | 
| index 91f37367dae9d0ec815cbd4738bc62484e1df80f..c33303e3cbdb8965ce7f74ef46502bf1ca86d306 100644 | 
| --- a/test/cctest/test-api.cc | 
| +++ b/test/cctest/test-api.cc | 
| @@ -9999,6 +9999,50 @@ THREADED_TEST(Regress91517) { | 
| } | 
| +// Getting property names of an object with a hidden and inherited | 
| +// prototype should not duplicate the accessor properties inherited. | 
| +THREADED_TEST(Regress269562) { | 
| + i::FLAG_allow_natives_syntax = true; | 
| + LocalContext context; | 
| + v8::HandleScope handle_scope(context->GetIsolate()); | 
| + | 
| + Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(); | 
| 
jochen (gone - plz use gerrit)
2013/12/17 15:00:53
please pass an isolate to ::New (here and below)
 | 
| + t1->SetHiddenPrototype(true); | 
| + | 
| + Local<v8::ObjectTemplate> i1 = t1->InstanceTemplate(); | 
| + i1->SetAccessor(v8_str("foo"), | 
| + SimpleAccessorGetter, SimpleAccessorSetter); | 
| + i1->SetAccessor(v8_str("bar"), | 
| + SimpleAccessorGetter, SimpleAccessorSetter); | 
| + i1->SetAccessor(v8_str("baz"), | 
| + SimpleAccessorGetter, SimpleAccessorSetter); | 
| + i1->Set(v8_str("n1"), v8_num(1)); | 
| + i1->Set(v8_str("n2"), v8_num(2)); | 
| + | 
| + Local<v8::Object> o1 = t1->GetFunction()->NewInstance(); | 
| + Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(); | 
| + t2->SetHiddenPrototype(true); | 
| + | 
| + // Inherit from t1 and mark prototype as hidden. | 
| + t2->Inherit(t1); | 
| + t2->InstanceTemplate()->Set(v8_str("mine"), v8_num(4)); | 
| + | 
| + Local<v8::Object> o2 = t2->GetFunction()->NewInstance(); | 
| + CHECK(o2->SetPrototype(o1)); | 
| + | 
| + // Call the runtime version of GetLocalPropertyNames() on | 
| + // the natively created object through JavaScript. | 
| + context->Global()->Set(v8_str("obj"), o2); | 
| + CompileRun("var names = %GetLocalPropertyNames(obj, true);"); | 
| + | 
| + ExpectInt32("names.length", 4); | 
| + ExpectTrue("names.indexOf(\"foo\") >= 0"); | 
| + ExpectTrue("names.indexOf(\"bar\") >= 0"); | 
| + ExpectTrue("names.indexOf(\"baz\") >= 0"); | 
| + ExpectTrue("names.indexOf(\"mine\") >= 0"); | 
| +} | 
| + | 
| + | 
| THREADED_TEST(FunctionReadOnlyPrototype) { | 
| LocalContext context; | 
| v8::HandleScope handle_scope(context->GetIsolate()); |