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

Side by Side Diff: test/cctest/test-api.cc

Issue 2270005: Make intercepted properties retrievable only by getter to be not enumerable. (Closed)
Patch Set: Created 10 years, 7 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 unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 7210 matching lines...) Expand 10 before | Expand all | Expand 10 after
7221 LocalContext context; 7221 LocalContext context;
7222 templ->Set("42", v8_num(42)); 7222 templ->Set("42", v8_num(42));
7223 v8::Handle<v8::Object> obj = templ->NewInstance(); 7223 v8::Handle<v8::Object> obj = templ->NewInstance();
7224 context->Global()->Set(v8_str("obj"), obj); 7224 context->Global()->Set(v8_str("obj"), obj);
7225 v8::Handle<Value> value = CompileRun("obj[42]"); 7225 v8::Handle<Value> value = CompileRun("obj[42]");
7226 CHECK(value->IsInt32()); 7226 CHECK(value->IsInt32());
7227 CHECK_EQ(42, value->Int32Value()); 7227 CHECK_EQ(42, value->Int32Value());
7228 } 7228 }
7229 7229
7230 7230
7231 THREADED_TEST(NamedPropertyHandlerGetterAttributes) {
7232 v8::HandleScope scope;
7233 v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
7234 templ->InstanceTemplate()->SetNamedPropertyHandler(InterceptorLoadXICGetter);
7235 LocalContext env;
7236 env->Global()->Set(v8_str("obj"),
7237 templ->GetFunction()->NewInstance());
7238 ExpectTrue("obj.x === 42");
7239 ExpectTrue("!obj.propertyIsEnumerable('x')");
7240 }
7241
7242
7231 static v8::Handle<Value> ParentGetter(Local<String> name, 7243 static v8::Handle<Value> ParentGetter(Local<String> name,
7232 const AccessorInfo& info) { 7244 const AccessorInfo& info) {
7233 ApiTestFuzzer::Fuzz(); 7245 ApiTestFuzzer::Fuzz();
7234 return v8_num(1); 7246 return v8_num(1);
7235 } 7247 }
7236 7248
7237 7249
7238 static v8::Handle<Value> ChildGetter(Local<String> name, 7250 static v8::Handle<Value> ChildGetter(Local<String> name,
7239 const AccessorInfo& info) { 7251 const AccessorInfo& info) {
7240 ApiTestFuzzer::Fuzz(); 7252 ApiTestFuzzer::Fuzz();
(...skipping 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after
10607 const char* code = 10619 const char* code =
10608 "(function() {" 10620 "(function() {"
10609 " for (var i = 0; i < 2*16; i++) {" 10621 " for (var i = 0; i < 2*16; i++) {"
10610 " %_GetFromCache(0, 'a' + i);" 10622 " %_GetFromCache(0, 'a' + i);"
10611 " };" 10623 " };"
10612 " return 'PASSED';" 10624 " return 'PASSED';"
10613 "})()"; 10625 "})()";
10614 v8::internal::Heap::ClearJSFunctionResultCaches(); 10626 v8::internal::Heap::ClearJSFunctionResultCaches();
10615 ExpectString(code, "PASSED"); 10627 ExpectString(code, "PASSED");
10616 } 10628 }
OLDNEW
« 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