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

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: Ensure @@isConcatSpreadable is actually installed now that its in a separate list 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
« no previous file with comments | « src/profiler/heap-snapshot-generator.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 21849 matching lines...) Expand 10 before | Expand all | Expand 10 after
21860 21860
21861 21861
21862 TEST(EstimatedContextSize) { 21862 TEST(EstimatedContextSize) {
21863 v8::Isolate* isolate = CcTest::isolate(); 21863 v8::Isolate* isolate = CcTest::isolate();
21864 v8::HandleScope scope(isolate); 21864 v8::HandleScope scope(isolate);
21865 LocalContext env; 21865 LocalContext env;
21866 CHECK(50000 < env->EstimatedSize()); 21866 CHECK(50000 < env->EstimatedSize());
21867 } 21867 }
21868 21868
21869 21869
21870 static int nb_uncaught_exception_callback_calls = 0; 21870 TEST(AccessCheckedIsConcatSpreadable) {
21871 i::FLAG_harmony_concat_spreadable = true;
21872 v8::Isolate* isolate = CcTest::isolate();
21873 HandleScope scope(isolate);
21874 LocalContext env;
21871 21875
21876 // Object with access check
21877 Local<ObjectTemplate> spreadable_template = v8::ObjectTemplate::New(isolate);
21878 spreadable_template->SetAccessCheckCallbacks(AccessBlocker, nullptr);
21879 spreadable_template->Set(v8::Symbol::GetIsConcatSpreadable(isolate),
21880 v8::Boolean::New(isolate, true));
21881 Local<Object> object = spreadable_template->NewInstance();
21872 21882
21873 bool NoAbortOnUncaughtException(v8::Isolate* isolate) { 21883 allowed_access = true;
21874 ++nb_uncaught_exception_callback_calls; 21884 env->Global()->Set(v8_str("object"), object);
21875 return false; 21885 object->Set(v8_str("length"), v8_num(2));
21886 object->Set(0U, v8_str("a"));
21887 object->Set(1U, v8_str("b"));
21888
21889 // Access check is allowed, and the object is spread
21890 CompileRun("var result = [].concat(object)");
21891 ExpectTrue("Array.isArray(result)");
21892 ExpectString("result[0]", "a");
21893 ExpectString("result[1]", "b");
21894 ExpectTrue("result.length === 2");
21895 ExpectTrue("object[Symbol.isConcatSpreadable]");
21896
21897 // If access check fails, the value of @@isConcatSpreadable is ignored
21898 allowed_access = false;
21899 CompileRun("var result = [].concat(object)");
21900 ExpectTrue("Array.isArray(result)");
21901 ExpectTrue("result[0] === object");
21902 ExpectTrue("result.length === 1");
21903 ExpectTrue("object[Symbol.isConcatSpreadable] === undefined");
21876 } 21904 }
21877
21878
21879 TEST(AbortOnUncaughtExceptionNoAbort) {
21880 v8::Isolate* isolate = CcTest::isolate();
21881 v8::HandleScope handle_scope(isolate);
21882 v8::Handle<v8::ObjectTemplate> global_template =
21883 v8::ObjectTemplate::New(isolate);
21884 LocalContext env(NULL, global_template);
21885
21886 i::FLAG_abort_on_uncaught_exception = true;
21887 isolate->SetAbortOnUncaughtExceptionCallback(NoAbortOnUncaughtException);
21888
21889 CompileRun("function boom() { throw new Error(\"boom\") }");
21890
21891 v8::Local<v8::Object> global_object = env->Global();
21892 v8::Local<v8::Function> foo =
21893 v8::Local<v8::Function>::Cast(global_object->Get(v8_str("boom")));
21894
21895 foo->Call(global_object, 0, NULL);
21896
21897 CHECK_EQ(1, nb_uncaught_exception_callback_calls);
21898 }
OLDNEW
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698