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

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

Issue 536943002: Never skip access checks when looking up properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/runtime.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 v8::Local<v8::Value> res = CompileRun("var a = []; a;"); 2037 v8::Local<v8::Value> res = CompileRun("var a = []; a;");
2038 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res))); 2038 i::Handle<i::JSObject> a(v8::Utils::OpenHandle(v8::Object::Cast(*res)));
2039 CHECK(a->map()->instance_descriptors()->IsFixedArray()); 2039 CHECK(a->map()->instance_descriptors()->IsFixedArray());
2040 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); 2040 CHECK_GT(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0);
2041 CompileRun("Object.defineProperty(a, 'length', { writable: false });"); 2041 CompileRun("Object.defineProperty(a, 'length', { writable: false });");
2042 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0); 2042 CHECK_EQ(i::FixedArray::cast(a->map()->instance_descriptors())->length(), 0);
2043 // But we should still have an ExecutableAccessorInfo. 2043 // But we should still have an ExecutableAccessorInfo.
2044 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 2044 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
2045 i::LookupResult lookup(i_isolate); 2045 i::LookupResult lookup(i_isolate);
2046 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length"))); 2046 i::Handle<i::String> name(v8::Utils::OpenHandle(*v8_str("length")));
2047 i::LookupIterator it(a, name, i::LookupIterator::OWN_PROPERTY); 2047 i::LookupIterator it(a, name, i::LookupIterator::OWN_SKIP_INTERCEPTOR);
2048 CHECK_NE(i::LookupIterator::ACCESS_CHECK, it.state());
2048 CHECK(it.HasProperty()); 2049 CHECK(it.HasProperty());
2049 CHECK(it.GetAccessors()->IsExecutableAccessorInfo()); 2050 CHECK(it.GetAccessors()->IsExecutableAccessorInfo());
2050 } 2051 }
2051 2052
2052 2053
2053 THREADED_TEST(EmptyInterceptorBreakTransitions) { 2054 THREADED_TEST(EmptyInterceptorBreakTransitions) {
2054 v8::HandleScope scope(CcTest::isolate()); 2055 v8::HandleScope scope(CcTest::isolate());
2055 Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate()); 2056 Handle<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
2056 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter); 2057 AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
2057 LocalContext env; 2058 LocalContext env;
(...skipping 20935 matching lines...) Expand 10 before | Expand all | Expand 10 after
22993 desc = x->GetOwnPropertyDescriptor(v8_str("p1")); 22994 desc = x->GetOwnPropertyDescriptor(v8_str("p1"));
22994 Local<Function> set = 22995 Local<Function> set =
22995 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set"))); 22996 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("set")));
22996 Local<Function> get = 22997 Local<Function> get =
22997 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get"))); 22998 Local<Function>::Cast(Local<Object>::Cast(desc)->Get(v8_str("get")));
22998 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL)); 22999 CHECK_EQ(v8_num(13), get->Call(x, 0, NULL));
22999 Handle<Value> args[] = { v8_num(14) }; 23000 Handle<Value> args[] = { v8_num(14) };
23000 set->Call(x, 1, args); 23001 set->Call(x, 1, args);
23001 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL)); 23002 CHECK_EQ(v8_num(14), get->Call(x, 0, NULL));
23002 } 23003 }
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698