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

Side by Side 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, 2 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
« src/objects.cc ('K') | « 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 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 21845 matching lines...) Expand 10 before | Expand all | Expand 10 after
21856 timeout_thread.Join(); 21856 timeout_thread.Join();
21857 } 21857 }
21858 21858
21859 21859
21860 TEST(EstimatedContextSize) { 21860 TEST(EstimatedContextSize) {
21861 v8::Isolate* isolate = CcTest::isolate(); 21861 v8::Isolate* isolate = CcTest::isolate();
21862 v8::HandleScope scope(isolate); 21862 v8::HandleScope scope(isolate);
21863 LocalContext env; 21863 LocalContext env;
21864 CHECK(50000 < env->EstimatedSize()); 21864 CHECK(50000 < env->EstimatedSize());
21865 } 21865 }
21866
21867
21868 TEST(AccessCheckedIsConcatSpreadable) {
21869 i::FLAG_harmony_concat_spreadable = true;
21870 v8::Isolate* isolate = CcTest::isolate();
21871 HandleScope scope(isolate);
21872 LocalContext env;
21873
21874 // Object with access check
21875 Local<ObjectTemplate> spreadable_template = v8::ObjectTemplate::New(isolate);
21876 spreadable_template->SetAccessCheckCallbacks(AccessBlocker, nullptr);
21877 spreadable_template->Set(v8::Symbol::GetIsConcatSpreadable(isolate),
21878 v8::Boolean::New(isolate, true));
21879 Local<Object> object = spreadable_template->NewInstance();
21880
21881 allowed_access = true;
21882 env->Global()->Set(v8_str("object"), object);
21883 object->Set(v8_str("length"), v8_num(2));
21884 object->Set(0U, v8_str("a"));
21885 object->Set(1U, v8_str("b"));
21886
21887 // Access check is allowed, and the object is spread
21888 CompileRun("var result = [].concat(object)");
21889 ExpectTrue("Array.isArray(result)");
21890 ExpectString("result[0]", "a");
21891 ExpectString("result[1]", "b");
21892 ExpectTrue("result.length === 2");
21893
21894 // If access check fails, the value of @@isConcatSpreadable is ignored
21895 allowed_access = false;
21896 CompileRun("var result = [].concat(object)");
21897 ExpectTrue("Array.isArray(result)");
21898 ExpectTrue("result[0] === object");
21899 ExpectTrue("result.length === 1");
21900 }
OLDNEW
« 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