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

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: Refactor (Alternative Impl.) Created 5 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 side-by-side diff with in-line comments
Download patch
« src/objects.cc ('K') | « src/objects.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 ab44af7f934aae2a2dde02dcdc2f7545d5ca5d26..b56c46ecc3c144ec7c8b15a376078a7e017d8dde 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -21863,3 +21863,38 @@ TEST(EstimatedContextSize) {
LocalContext env;
CHECK(50000 < env->EstimatedSize());
}
+
+
+TEST(AccessCheckedIsConcatSpreadable) {
+ i::FLAG_harmony_concat_spreadable = true;
+ v8::Isolate* isolate = CcTest::isolate();
+ HandleScope scope(isolate);
+ LocalContext env;
+
+ // Object with access check
+ Local<ObjectTemplate> spreadable_template = v8::ObjectTemplate::New(isolate);
+ spreadable_template->SetAccessCheckCallbacks(AccessBlocker, nullptr);
+ spreadable_template->Set(v8::Symbol::GetIsConcatSpreadable(isolate),
+ v8::Boolean::New(isolate, true));
+ Local<Object> object = spreadable_template->NewInstance();
+
+ allowed_access = true;
+ env->Global()->Set(v8_str("object"), object);
+ object->Set(v8_str("length"), v8_num(2));
+ object->Set(0U, v8_str("a"));
+ object->Set(1U, v8_str("b"));
+
+ // Access check is allowed, and the object is spread
+ CompileRun("var result = [].concat(object)");
+ ExpectTrue("Array.isArray(result)");
+ ExpectString("result[0]", "a");
+ ExpectString("result[1]", "b");
+ ExpectTrue("result.length === 2");
+
+ // If access check fails, the value of @@isConcatSpreadable is ignored
+ allowed_access = false;
+ CompileRun("var result = [].concat(object)");
+ ExpectTrue("Array.isArray(result)");
+ ExpectTrue("result[0] === object");
+ ExpectTrue("result.length === 1");
+}
« src/objects.cc ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698