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

Unified Diff: test/cctest/test-api-interceptors.cc

Issue 1217893012: Remove deprecated v8::Object::TurnOnAccessCheck() from the V8 API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Deoptimizer::DeoptimizeGlobalObject() removed Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/mjsunit/migrations.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api-interceptors.cc
diff --git a/test/cctest/test-api-interceptors.cc b/test/cctest/test-api-interceptors.cc
index f0f817ffc151893c0c5b31d4d0bfbcfd73a5a548..46163d43f98b49bfb8edc08ad1af7f367ae07a34 100644
--- a/test/cctest/test-api-interceptors.cc
+++ b/test/cctest/test-api-interceptors.cc
@@ -1658,6 +1658,12 @@ THREADED_TEST(IndexedInterceptorWithNoSetter) {
}
+static bool AccessAlwaysBlocked(Local<v8::Object> global, Local<Value> name,
+ v8::AccessType type, Local<Value> data) {
+ return false;
+}
+
+
THREADED_TEST(IndexedInterceptorWithAccessorCheck) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
@@ -1665,9 +1671,10 @@ THREADED_TEST(IndexedInterceptorWithAccessorCheck) {
templ->SetHandler(
v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
+ templ->SetAccessCheckCallbacks(AccessAlwaysBlocked, nullptr);
+
LocalContext context;
Local<v8::Object> obj = templ->NewInstance();
- obj->TurnOnAccessCheck();
context->Global()->Set(v8_str("obj"), obj);
const char* code =
@@ -1686,46 +1693,6 @@ THREADED_TEST(IndexedInterceptorWithAccessorCheck) {
}
-THREADED_TEST(IndexedInterceptorWithAccessorCheckSwitchedOn) {
- i::FLAG_allow_natives_syntax = true;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
- templ->SetHandler(
- v8::IndexedPropertyHandlerConfiguration(IdentityIndexedPropertyGetter));
-
- LocalContext context;
- Local<v8::Object> obj = templ->NewInstance();
- context->Global()->Set(v8_str("obj"), obj);
-
- const char* code =
- "var result = 'PASSED';"
- "for (var i = 0; i < 100; i++) {"
- " var expected = i;"
- " if (i == 5) {"
- " %EnableAccessChecks(obj);"
- " }"
- " try {"
- " var v = obj[i];"
- " if (i == 5) {"
- " result = 'Should not have reached this!';"
- " break;"
- " } else if (v != expected) {"
- " result = 'Wrong value ' + v + ' at iteration ' + i;"
- " break;"
- " }"
- " } catch (e) {"
- " if (i != 5) {"
- " result = e;"
- " }"
- " }"
- " if (i == 5) %DisableAccessChecks(obj);"
- "}"
- "result";
- ExpectString(code, "PASSED");
-}
-
-
THREADED_TEST(IndexedInterceptorWithDifferentIndices) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
@@ -2975,7 +2942,7 @@ THREADED_TEST(NamedAllCanReadInterceptor) {
LocalContext context;
AccessCheckData access_check_data;
- access_check_data.result = false;
+ access_check_data.result = true;
access_check_data.count = 0;
ShouldInterceptData intercept_data_0;
@@ -3007,7 +2974,7 @@ THREADED_TEST(NamedAllCanReadInterceptor) {
auto checked = v8::ObjectTemplate::New(isolate);
checked->SetAccessCheckCallbacks(
SimpleAccessChecker, nullptr,
- BuildWrappedObject<AccessCheckData>(isolate, &access_check_data), false);
+ BuildWrappedObject<AccessCheckData>(isolate, &access_check_data));
context->Global()->Set(v8_str("intercepted_0"), intercepted_0->NewInstance());
context->Global()->Set(v8_str("intercepted_1"), intercepted_1->NewInstance());
@@ -3018,14 +2985,12 @@ THREADED_TEST(NamedAllCanReadInterceptor) {
"checked.__proto__ = intercepted_1;"
"intercepted_1.__proto__ = intercepted_0;");
- checked_instance->TurnOnAccessCheck();
- CHECK_EQ(0, access_check_data.count);
+ CHECK_EQ(3, access_check_data.count);
- access_check_data.result = true;
ExpectInt32("checked.whatever", 17);
CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')")
->IsUndefined());
- CHECK_EQ(2, access_check_data.count);
+ CHECK_EQ(5, access_check_data.count);
access_check_data.result = false;
ExpectInt32("checked.whatever", intercept_data_0.value);
@@ -3034,7 +2999,7 @@ THREADED_TEST(NamedAllCanReadInterceptor) {
CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')");
CHECK(try_catch.HasCaught());
}
- CHECK_EQ(4, access_check_data.count);
+ CHECK_EQ(7, access_check_data.count);
intercept_data_1.should_intercept = true;
ExpectInt32("checked.whatever", intercept_data_1.value);
@@ -3043,7 +3008,7 @@ THREADED_TEST(NamedAllCanReadInterceptor) {
CompileRun("Object.getOwnPropertyDescriptor(checked, 'whatever')");
CHECK(try_catch.HasCaught());
}
- CHECK_EQ(6, access_check_data.count);
+ CHECK_EQ(9, access_check_data.count);
}
@@ -3053,7 +3018,7 @@ THREADED_TEST(IndexedAllCanReadInterceptor) {
LocalContext context;
AccessCheckData access_check_data;
- access_check_data.result = false;
+ access_check_data.result = true;
access_check_data.count = 0;
ShouldInterceptData intercept_data_0;
@@ -3085,7 +3050,7 @@ THREADED_TEST(IndexedAllCanReadInterceptor) {
auto checked = v8::ObjectTemplate::New(isolate);
checked->SetAccessCheckCallbacks(
SimpleAccessChecker, nullptr,
- BuildWrappedObject<AccessCheckData>(isolate, &access_check_data), false);
+ BuildWrappedObject<AccessCheckData>(isolate, &access_check_data));
context->Global()->Set(v8_str("intercepted_0"), intercepted_0->NewInstance());
context->Global()->Set(v8_str("intercepted_1"), intercepted_1->NewInstance());
@@ -3096,14 +3061,13 @@ THREADED_TEST(IndexedAllCanReadInterceptor) {
"checked.__proto__ = intercepted_1;"
"intercepted_1.__proto__ = intercepted_0;");
- checked_instance->TurnOnAccessCheck();
- CHECK_EQ(0, access_check_data.count);
+ CHECK_EQ(3, access_check_data.count);
access_check_data.result = true;
ExpectInt32("checked[15]", 17);
CHECK(!CompileRun("Object.getOwnPropertyDescriptor(checked, '15')")
->IsUndefined());
- CHECK_EQ(2, access_check_data.count);
+ CHECK_EQ(5, access_check_data.count);
access_check_data.result = false;
ExpectInt32("checked[15]", intercept_data_0.value);
@@ -3112,7 +3076,7 @@ THREADED_TEST(IndexedAllCanReadInterceptor) {
CompileRun("Object.getOwnPropertyDescriptor(checked, '15')");
CHECK(try_catch.HasCaught());
}
- CHECK_EQ(4, access_check_data.count);
+ CHECK_EQ(7, access_check_data.count);
intercept_data_1.should_intercept = true;
ExpectInt32("checked[15]", intercept_data_1.value);
@@ -3121,7 +3085,7 @@ THREADED_TEST(IndexedAllCanReadInterceptor) {
CompileRun("Object.getOwnPropertyDescriptor(checked, '15')");
CHECK(try_catch.HasCaught());
}
- CHECK_EQ(6, access_check_data.count);
+ CHECK_EQ(9, access_check_data.count);
}
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/mjsunit/migrations.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698