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

Side by Side Diff: test/cctest/test-api.cc

Issue 1392763003: [test] re-add test for SetAbortOnUncaughtExceptionCallback() API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | 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 21847 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 21866
21867 21867
21868 static int nb_uncaught_exception_callback_calls = 0;
21869
21870
21871 bool NoAbortOnUncaughtException(v8::Isolate* isolate) {
21872 ++nb_uncaught_exception_callback_calls;
21873 return false;
21874 }
21875
21876
21877 TEST(AbortOnUncaughtExceptionNoAbort) {
21878 v8::Isolate* isolate = CcTest::isolate();
21879 v8::HandleScope handle_scope(isolate);
21880 v8::Handle<v8::ObjectTemplate> global_template =
21881 v8::ObjectTemplate::New(isolate);
21882 LocalContext env(NULL, global_template);
21883
21884 i::FLAG_abort_on_uncaught_exception = true;
21885 isolate->SetAbortOnUncaughtExceptionCallback(NoAbortOnUncaughtException);
21886
21887 CompileRun("function boom() { throw new Error(\"boom\") }");
21888
21889 v8::Local<v8::Object> global_object = env->Global();
21890 v8::Local<v8::Function> foo =
21891 v8::Local<v8::Function>::Cast(global_object->Get(v8_str("boom")));
21892
21893 foo->Call(global_object, 0, NULL);
21894
21895 CHECK_EQ(1, nb_uncaught_exception_callback_calls);
21896 }
21897
21898
21868 TEST(AccessCheckedIsConcatSpreadable) { 21899 TEST(AccessCheckedIsConcatSpreadable) {
21869 i::FLAG_harmony_concat_spreadable = true; 21900 i::FLAG_harmony_concat_spreadable = true;
21870 v8::Isolate* isolate = CcTest::isolate(); 21901 v8::Isolate* isolate = CcTest::isolate();
21871 HandleScope scope(isolate); 21902 HandleScope scope(isolate);
21872 LocalContext env; 21903 LocalContext env;
21873 21904
21874 // Object with access check 21905 // Object with access check
21875 Local<ObjectTemplate> spreadable_template = v8::ObjectTemplate::New(isolate); 21906 Local<ObjectTemplate> spreadable_template = v8::ObjectTemplate::New(isolate);
21876 spreadable_template->SetAccessCheckCallbacks(AccessBlocker, nullptr); 21907 spreadable_template->SetAccessCheckCallbacks(AccessBlocker, nullptr);
21877 spreadable_template->Set(v8::Symbol::GetIsConcatSpreadable(isolate), 21908 spreadable_template->Set(v8::Symbol::GetIsConcatSpreadable(isolate),
(...skipping 15 matching lines...) Expand all
21893 ExpectTrue("object[Symbol.isConcatSpreadable]"); 21924 ExpectTrue("object[Symbol.isConcatSpreadable]");
21894 21925
21895 // If access check fails, the value of @@isConcatSpreadable is ignored 21926 // If access check fails, the value of @@isConcatSpreadable is ignored
21896 allowed_access = false; 21927 allowed_access = false;
21897 CompileRun("var result = [].concat(object)"); 21928 CompileRun("var result = [].concat(object)");
21898 ExpectTrue("Array.isArray(result)"); 21929 ExpectTrue("Array.isArray(result)");
21899 ExpectTrue("result[0] === object"); 21930 ExpectTrue("result[0] === object");
21900 ExpectTrue("result.length === 1"); 21931 ExpectTrue("result.length === 1");
21901 ExpectTrue("object[Symbol.isConcatSpreadable] === undefined"); 21932 ExpectTrue("object[Symbol.isConcatSpreadable] === undefined");
21902 } 21933 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698