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

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

Issue 1375933003: Add SetAbortOnUncaughtExceptionCallback API (Closed) Base URL: git@github.com:v8/v8.git@master
Patch Set: Update after second code review 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/isolate.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 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 }
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698