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

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

Issue 1230793002: [es6] silence access-check failure for well-known symbol properties (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove pointless test part Created 5 years, 5 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 | « src/runtime/runtime-array.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 2bfdeabd42cd606a40e8242d120465dc0414a0ab..94295d872018d97282905acf984f760df0a35b2f 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -21855,3 +21855,55 @@ TEST(CompatibleReceiverCheckOnCachedICHandler) {
"result;\n",
0);
}
+
+
+static bool AccessSymbolsAlwaysBlocked(Local<v8::Object> global,
+ Local<Value> name, v8::AccessType type,
+ Local<Value> data) {
+ if (!name->IsSymbol()) return true;
+ i::PrintF("Access blocked.\n");
+ return false;
+}
+
+
+THREADED_TEST(Regress507553) {
+ v8::Isolate* isolate = CcTest::isolate();
+ HandleScope scope(isolate);
+
+ // Template for object with security check.
+ Local<ObjectTemplate> spreadable_template = v8::ObjectTemplate::New(isolate);
+ spreadable_template->SetAccessCheckCallbacks(AccessSymbolsAlwaysBlocked,
+ NULL);
+
+ // Context for "foreign" objects used in test.
+ Local<Context> context = v8::Context::New(isolate);
+ context->Enter();
+
+ // Object with explicit security check.
+ Local<Object> protected_object = spreadable_template->NewInstance();
+
+ // JSGlobalProxy object, always have security check.
+ Local<Object> proxy_object = context->Global();
+
+ // Global object, the prototype of proxy_object. No security checks.
+ Local<Object> global_object = proxy_object->GetPrototype()->ToObject(isolate);
adamk 2015/07/09 18:59:13 I don't think you need this stuff any more.
+
+ spreadable_template->Set(v8::Symbol::GetIsConcatSpreadable(isolate),
+ v8::Boolean::New(isolate, true));
+
+ protected_object->Set(v8_str("length"), v8::Integer::New(isolate, 2));
+ protected_object->Set(0U, v8_str("a"));
+ protected_object->Set(1U, v8_str("b"));
+
+ Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate);
+ global_template->Set(v8_str("protected"), protected_object);
+ global_template->Set(v8_str("global"), global_object);
+
+ context->Exit();
+
+ LocalContext context2(NULL, global_template);
+
+ Local<Value> result1 = CompileRun("[].concat(protected)");
+ CHECK(result1->IsArray());
+ CHECK(result1.As<Object>()->Get(0)->Equals(protected_object));
adamk 2015/07/09 18:59:13 I think you also want a test for an access checked
+}
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698