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

Unified Diff: test/cctest/test-api.cc

Issue 1154423004: Update all callsites of the TryCatch ctor to pass an Isolate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « test/cctest/test-accessors.cc ('k') | test/cctest/test-debug.cc » ('j') | 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 669a5cf5085cc9ac125ccad2c7438da704f5d8ed..896115d7403f6a2c72c43e49e5258da71c4696b4 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -190,7 +190,7 @@ static void TestSignature(const char* loop_js, Local<Value> receiver,
signature_callback_count = 0;
signature_expected_receiver = receiver;
bool expected_to_throw = receiver.IsEmpty();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(source.start());
CHECK_EQ(expected_to_throw, try_catch.HasCaught());
if (!expected_to_throw) {
@@ -697,7 +697,7 @@ THREADED_TEST(NewExternalForVeryLongString) {
auto isolate = CcTest::isolate();
{
v8::HandleScope scope(isolate);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
RandomLengthOneByteResource r(1 << 30);
v8::Local<v8::String> str = v8::String::NewExternal(isolate, &r);
CHECK(str.IsEmpty());
@@ -706,7 +706,7 @@ THREADED_TEST(NewExternalForVeryLongString) {
{
v8::HandleScope scope(isolate);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
RandomLengthResource r(1 << 30);
v8::Local<v8::String> str = v8::String::NewExternal(isolate, &r);
CHECK(str.IsEmpty());
@@ -4012,7 +4012,7 @@ THREADED_TEST(ScriptException) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
Local<Script> script = v8_compile("throw 'panama!';");
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(env->GetIsolate());
Local<Value> result = script->Run();
CHECK(result.IsEmpty());
CHECK(try_catch.HasCaught());
@@ -4025,7 +4025,7 @@ TEST(TryCatchCustomException) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"function CustomError() { this.a = 'b'; }"
"(function f() { throw new CustomError(); })();");
@@ -4357,7 +4357,7 @@ THREADED_TEST(PropertyAttributes) {
Local<Value> fake_prop = v8_num(1);
CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(fake_prop));
// exception
- TryCatch try_catch;
+ TryCatch try_catch(context->GetIsolate());
Local<Value> exception =
CompileRun("({ toString: function() { throw 'exception';} })");
CHECK_EQ(v8::None, context->Global()->GetPropertyAttributes(exception));
@@ -4752,7 +4752,7 @@ void CCatcher(const v8::FunctionCallbackInfo<v8::Value>& args) {
return;
}
v8::HandleScope scope(args.GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(args.GetIsolate());
Local<Value> result = CompileRun(args[0]->ToString(args.GetIsolate()));
CHECK(!try_catch.HasCaught() || result.IsEmpty());
args.GetReturnValue().Set(try_catch.HasCaught());
@@ -4785,7 +4785,7 @@ THREADED_TEST(APIThrowTryCatch) {
templ->Set(v8_str("ThrowFromC"),
v8::FunctionTemplate::New(isolate, ThrowFromC));
LocalContext context(0, templ);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun("ThrowFromC();");
CHECK(try_catch.HasCaught());
}
@@ -5001,7 +5001,7 @@ TEST(APIThrowMessageAndVerboseTryCatch) {
templ->Set(v8_str("ThrowFromC"),
v8::FunctionTemplate::New(isolate, ThrowFromC));
LocalContext context(0, templ);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
try_catch.SetVerbose(true);
Local<Value> result = CompileRun("ThrowFromC();");
CHECK(try_catch.HasCaught());
@@ -5016,7 +5016,7 @@ TEST(APIStackOverflowAndVerboseTryCatch) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
v8::V8::AddMessageListener(receive_message);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
try_catch.SetVerbose(true);
Local<Value> result = CompileRun("function foo() { foo(); } foo();");
CHECK(try_catch.HasCaught());
@@ -5034,7 +5034,7 @@ THREADED_TEST(ExternalScriptException) {
v8::FunctionTemplate::New(isolate, ThrowFromC));
LocalContext context(0, templ);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<Value> result = CompileRun("ThrowFromC(); throw 'panama';");
CHECK(result.IsEmpty());
CHECK(try_catch.HasCaught());
@@ -5056,7 +5056,7 @@ void CThrowCountDown(const v8::FunctionCallbackInfo<v8::Value>& args) {
Local<Value> fun = global->Get(v8_str("JSThrowCountDown"));
v8::Handle<Value> argv[] = {v8_num(count - 1), args[1], args[2], args[3]};
if (count % cInterval == 0) {
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(args.GetIsolate());
Local<Value> result = fun.As<Function>()->Call(global, 4, argv);
int expected = args[3]->Int32Value();
if (try_catch.HasCaught()) {
@@ -5093,7 +5093,7 @@ void JSCheck(const v8::FunctionCallbackInfo<v8::Value>& args) {
THREADED_TEST(EvalInTryFinally) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
CompileRun(
"(function() {"
" try {"
@@ -5221,7 +5221,7 @@ THREADED_TEST(ThrowValues) {
THREADED_TEST(CatchZero) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
CHECK(!try_catch.HasCaught());
CompileRun("throw 10");
CHECK(try_catch.HasCaught());
@@ -5237,7 +5237,7 @@ THREADED_TEST(CatchZero) {
THREADED_TEST(CatchExceptionFromWith) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
CHECK(!try_catch.HasCaught());
CompileRun("var o = {}; with (o) { throw 42; }");
CHECK(try_catch.HasCaught());
@@ -5247,7 +5247,7 @@ THREADED_TEST(CatchExceptionFromWith) {
THREADED_TEST(TryCatchAndFinallyHidingException) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
CHECK(!try_catch.HasCaught());
CompileRun("function f(k) { try { this[k]; } finally { return 0; } };");
CompileRun("f({toString: function() { throw 42; }});");
@@ -5256,7 +5256,7 @@ THREADED_TEST(TryCatchAndFinallyHidingException) {
void WithTryCatch(const v8::FunctionCallbackInfo<v8::Value>& args) {
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(args.GetIsolate());
}
@@ -5267,7 +5267,7 @@ THREADED_TEST(TryCatchAndFinally) {
context->Global()->Set(
v8_str("native_with_try_catch"),
v8::FunctionTemplate::New(isolate, WithTryCatch)->GetFunction());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CHECK(!try_catch.HasCaught());
CompileRun(
"try {\n"
@@ -5281,7 +5281,7 @@ THREADED_TEST(TryCatchAndFinally) {
static void TryCatchNested1Helper(int depth) {
if (depth > 0) {
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(CcTest::isolate());
try_catch.SetVerbose(true);
TryCatchNested1Helper(depth - 1);
CHECK(try_catch.HasCaught());
@@ -5294,7 +5294,7 @@ static void TryCatchNested1Helper(int depth) {
static void TryCatchNested2Helper(int depth) {
if (depth > 0) {
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(CcTest::isolate());
try_catch.SetVerbose(true);
TryCatchNested2Helper(depth - 1);
CHECK(try_catch.HasCaught());
@@ -5312,7 +5312,7 @@ TEST(TryCatchNested) {
{
// Test nested try-catch with a native throw in the end.
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
TryCatchNested1Helper(5);
CHECK(try_catch.HasCaught());
CHECK_EQ(0, strcmp(*v8::String::Utf8Value(try_catch.Exception()), "E1"));
@@ -5320,7 +5320,7 @@ TEST(TryCatchNested) {
{
// Test nested try-catch with a JavaScript throw in the end.
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
TryCatchNested2Helper(5);
CHECK(try_catch.HasCaught());
CHECK_EQ(0, strcmp(*v8::String::Utf8Value(try_catch.Exception()), "E2"));
@@ -5343,7 +5343,7 @@ void TryCatchMixedNestingCheck(v8::TryCatch* try_catch) {
void TryCatchMixedNestingHelper(
const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(args.GetIsolate());
CompileRunWithOrigin("throw new Error('a');\n", "inner", 0, 0);
CHECK(try_catch.HasCaught());
TryCatchMixedNestingCheck(&try_catch);
@@ -5360,7 +5360,7 @@ TEST(TryCatchMixedNesting) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::V8::Initialize();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
templ->Set(v8_str("TryCatchMixedNestingHelper"),
v8::FunctionTemplate::New(isolate, TryCatchMixedNestingHelper));
@@ -5372,7 +5372,7 @@ TEST(TryCatchMixedNesting) {
void TryCatchNativeHelper(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(args.GetIsolate());
args.GetIsolate()->ThrowException(v8_str("boom"));
CHECK(try_catch.HasCaught());
}
@@ -5382,7 +5382,7 @@ TEST(TryCatchNative) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::V8::Initialize();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
templ->Set(v8_str("TryCatchNativeHelper"),
v8::FunctionTemplate::New(isolate, TryCatchNativeHelper));
@@ -5395,7 +5395,7 @@ TEST(TryCatchNative) {
void TryCatchNativeResetHelper(
const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(args.GetIsolate());
args.GetIsolate()->ThrowException(v8_str("boom"));
CHECK(try_catch.HasCaught());
try_catch.Reset();
@@ -5407,7 +5407,7 @@ TEST(TryCatchNativeReset) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::V8::Initialize();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
templ->Set(v8_str("TryCatchNativeResetHelper"),
v8::FunctionTemplate::New(isolate, TryCatchNativeResetHelper));
@@ -5533,7 +5533,7 @@ THREADED_TEST(DefinePropertyOnAPIAccessor) {
CHECK_EQ(result->BooleanValue(), false);
// Make sure that it is not possible to redefine again
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
result = script_define->Run();
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
@@ -5582,7 +5582,7 @@ THREADED_TEST(DefinePropertyOnDefineGetterSetter) {
CHECK_EQ(result->BooleanValue(), false);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
result = script_define->Run();
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Exception());
@@ -5704,7 +5704,7 @@ THREADED_TEST(DontDeleteAPIAccessorsCannotBeOverriden) {
->SetAccessor(v8_str("x"), GetXValue, NULL, v8_str("donut")));
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"Object.defineProperty(obj1, 'x',"
"{get: function() { return 'func'; }})");
@@ -5714,7 +5714,7 @@ THREADED_TEST(DontDeleteAPIAccessorsCannotBeOverriden) {
0, strcmp(*exception_value, "TypeError: Cannot redefine property: x"));
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"Object.defineProperty(obj2, 'x',"
"{get: function() { return 'func'; }})");
@@ -7499,7 +7499,7 @@ THREADED_TEST(ExceptionCreateMessage) {
v8::Local<v8::Object> global = context->Global();
global->Set(v8_str("throwV8Exception"), fun->GetFunction());
- TryCatch try_catch;
+ TryCatch try_catch(context->GetIsolate());
CompileRun(
"function f1() {\n"
" throwV8Exception();\n"
@@ -7733,7 +7733,7 @@ TEST(ExceptionInNativeScript) {
TEST(CompilationErrorUsingTryCatchHandler) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(env->GetIsolate());
v8_compile("This doesn't &*&@#$&*^ compile.");
CHECK(*try_catch.Exception());
CHECK(try_catch.HasCaught());
@@ -7743,7 +7743,7 @@ TEST(CompilationErrorUsingTryCatchHandler) {
TEST(TryCatchFinallyUsingTryCatchHandler) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(env->GetIsolate());
CompileRun("try { throw ''; } catch (e) {}");
CHECK(!try_catch.HasCaught());
CompileRun("try { throw ''; } finally {}");
@@ -7775,7 +7775,7 @@ TEST(TryCatchFinallyStoresMessageUsingTryCatchHandler) {
templ->Set(v8_str("CEvaluate"),
v8::FunctionTemplate::New(isolate, CEvaluate));
LocalContext context(0, templ);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun("try {"
" CEvaluate('throw 1;');"
"} finally {"
@@ -7902,7 +7902,7 @@ THREADED_TEST(SecurityChecks) {
Context::Scope scope_env2(env2);
// Call cross_domain_call, it should throw an exception
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(env1->GetIsolate());
Function::Cast(*spy2)->Call(env2->Global(), 0, NULL);
CHECK(try_catch.HasCaught());
}
@@ -8154,7 +8154,7 @@ TEST(ContextDetachGlobal) {
{
Local<Value> get_prop = global1->Get(v8_str("getProp"));
CHECK(get_prop->IsFunction());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(env1->GetIsolate());
Local<Value> r = Function::Cast(*get_prop)->Call(global1, 0, NULL);
CHECK(!try_catch.HasCaught());
CHECK_EQ(1, r->Int32Value());
@@ -8699,7 +8699,7 @@ TEST(SuperAccessControl) {
env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"var f = { m() { return super.hasOwnProperty; } }.m;"
"var m = %ToMethod(f, prohibited);"
@@ -8708,7 +8708,7 @@ TEST(SuperAccessControl) {
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"var f = {m() { return super[42]; } }.m;"
"var m = %ToMethod(f, prohibited);"
@@ -8717,7 +8717,7 @@ TEST(SuperAccessControl) {
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"var f = {m() { super.hasOwnProperty = function () {}; } }.m;"
"var m = %ToMethod(f, prohibited);"
@@ -8726,7 +8726,7 @@ TEST(SuperAccessControl) {
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"Object.defineProperty(Object.prototype, 'x', { set : function(){}});"
"var f = {"
@@ -8754,7 +8754,7 @@ TEST(Regress470113) {
env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"'use strict';\n"
"class C extends Object {\n"
@@ -9495,7 +9495,7 @@ THREADED_TEST(SetPrototypeThrows) {
CHECK(o0->SetPrototype(o1));
// If setting the prototype leads to the cycle, SetPrototype should
// return false and keep VM in sane state.
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CHECK(!o1->SetPrototype(o0));
CHECK(!try_catch.HasCaught());
DCHECK(!CcTest::i_isolate()->has_pending_exception());
@@ -9515,7 +9515,7 @@ THREADED_TEST(FunctionRemovePrototype) {
context->Global()->Set(v8_str("fun"), fun);
CHECK(!CompileRun("'prototype' in fun")->BooleanValue());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun("new fun()");
CHECK(try_catch.HasCaught());
@@ -9537,7 +9537,7 @@ THREADED_TEST(GetterSetterExceptions) {
"x.__defineGetter__('get', Throw);");
Local<v8::Object> x =
Local<v8::Object>::Cast(context->Global()->Get(v8_str("x")));
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
x->Set(v8_str("set"), v8::Integer::New(isolate, 8));
x->Get(v8_str("get"));
x->Set(v8_str("set"), v8::Integer::New(isolate, 8));
@@ -9603,7 +9603,7 @@ THREADED_TEST(ConstructorForObject) {
instance_template->SetCallAsFunctionHandler(ConstructorCallback);
Local<Object> instance = instance_template->NewInstance();
context->Global()->Set(v8_str("obj"), instance);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<Value> value;
CHECK(!try_catch.HasCaught());
@@ -9679,7 +9679,7 @@ THREADED_TEST(ConstructorForObject) {
Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
Local<Object> instance = instance_template->NewInstance();
context->Global()->Set(v8_str("obj2"), instance);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<Value> value;
CHECK(!try_catch.HasCaught());
@@ -9704,7 +9704,7 @@ THREADED_TEST(ConstructorForObject) {
instance_template->SetCallAsFunctionHandler(ThrowValue);
Local<Object> instance = instance_template->NewInstance();
context->Global()->Set(v8_str("obj3"), instance);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<Value> value;
CHECK(!try_catch.HasCaught());
@@ -9729,7 +9729,7 @@ THREADED_TEST(ConstructorForObject) {
Local<Function> function = function_template->GetFunction();
Local<Object> instance1 = function;
context->Global()->Set(v8_str("obj4"), instance1);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<Value> value;
CHECK(!try_catch.HasCaught());
@@ -9813,7 +9813,7 @@ THREADED_TEST(EvalAliasedDynamic) {
CHECK_EQ(0, current->Global()->Get(v8_str("result2"))->Int32Value());
CHECK_EQ(1, current->Global()->Get(v8_str("result3"))->Int32Value());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(current->GetIsolate());
script = v8_compile(
"function f(x) { "
" var bar = 2;"
@@ -9856,7 +9856,7 @@ THREADED_TEST(CrossEval) {
// Check that global variables in current context are not visible in other
// context.
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(CcTest::isolate());
script = v8_compile("var bar = 42; other.eval('bar');");
Local<Value> result = script->Run();
CHECK(try_catch.HasCaught());
@@ -9930,7 +9930,7 @@ THREADED_TEST(EvalInDetachedGlobal) {
v8::Handle<v8::Value> x_value = CompileRun("fun('x')");
CHECK_EQ(42, x_value->Int32Value());
context0->DetachGlobal();
- v8::TryCatch catcher;
+ v8::TryCatch catcher(isolate);
x_value = CompileRun("fun('x')");
CHECK_EQ(42, x_value->Int32Value());
context1->Exit();
@@ -9988,7 +9988,7 @@ THREADED_TEST(CallAsFunction) {
instance_template->SetCallAsFunctionHandler(call_as_function);
Local<v8::Object> instance = t->GetFunction()->NewInstance();
context->Global()->Set(v8_str("obj"), instance);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<Value> value;
CHECK(!try_catch.HasCaught());
@@ -10043,7 +10043,7 @@ THREADED_TEST(CallAsFunction) {
USE(instance_template);
Local<v8::Object> instance = t->GetFunction()->NewInstance();
context->Global()->Set(v8_str("obj2"), instance);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<Value> value;
CHECK(!try_catch.HasCaught());
@@ -10074,7 +10074,7 @@ THREADED_TEST(CallAsFunction) {
instance_template->SetCallAsFunctionHandler(ThrowValue);
Local<v8::Object> instance = t->GetFunction()->NewInstance();
context->Global()->Set(v8_str("obj3"), instance);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
Local<Value> value;
CHECK(!try_catch.HasCaught());
@@ -10172,7 +10172,7 @@ THREADED_TEST(CallableObject) {
Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
instance_template->SetCallAsFunctionHandler(call_as_function);
Local<Object> instance = instance_template->NewInstance();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CHECK(instance->IsCallable());
CHECK(!try_catch.HasCaught());
@@ -10181,7 +10181,7 @@ THREADED_TEST(CallableObject) {
{
Local<ObjectTemplate> instance_template = ObjectTemplate::New(isolate);
Local<Object> instance = instance_template->NewInstance();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CHECK(!instance->IsCallable());
CHECK(!try_catch.HasCaught());
@@ -10192,7 +10192,7 @@ THREADED_TEST(CallableObject) {
FunctionTemplate::New(isolate, call_as_function);
Local<Function> function = function_template->GetFunction();
Local<Object> instance = function;
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CHECK(instance->IsCallable());
CHECK(!try_catch.HasCaught());
@@ -10202,7 +10202,7 @@ THREADED_TEST(CallableObject) {
Local<FunctionTemplate> function_template = FunctionTemplate::New(isolate);
Local<Function> function = function_template->GetFunction();
Local<Object> instance = function;
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CHECK(instance->IsCallable());
CHECK(!try_catch.HasCaught());
@@ -10593,7 +10593,7 @@ THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"o.foo = 17;"
"var receiver = {};"
@@ -10636,7 +10636,7 @@ THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"o.foo = 17;"
"var receiver = {};"
@@ -10768,7 +10768,7 @@ THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) {
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"o.foo = 17;"
"var receiver = {};"
@@ -10807,7 +10807,7 @@ THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) {
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
context->Global()->Set(v8_str("o"), fun->NewInstance());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"o.foo = 17;"
"var receiver = {};"
@@ -10855,7 +10855,7 @@ THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) {
"o\n").As<Object>();
CHECK(!with_js_getter.IsEmpty());
- TryCatch try_catch;
+ TryCatch try_catch(context->GetIsolate());
Local<Value> result = instance->GetRealNamedProperty(v8_str("f"));
CHECK(try_catch.HasCaught());
@@ -10908,7 +10908,7 @@ THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) {
static void ThrowingCallbackWithTryCatch(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- TryCatch try_catch;
+ TryCatch try_catch(args.GetIsolate());
// Verboseness is important: it triggers message delivery which can call into
// external code.
try_catch.SetVerbose(true);
@@ -10923,7 +10923,7 @@ static int call_depth;
static void WithTryCatch(Handle<Message> message, Handle<Value> data) {
- TryCatch try_catch;
+ TryCatch try_catch(CcTest::isolate());
}
@@ -11212,7 +11212,7 @@ TEST(ObjectProtoToStringES6) {
Local<Value> obj = v8::Object::New(isolate);
obj.As<v8::Object>()->SetAccessor(toStringTag, ThrowingSymbolAccessorGetter);
{
- TryCatch try_catch;
+ TryCatch try_catch(isolate);
value = obj.As<v8::Object>()->ObjectProtoToString();
CHECK(value.IsEmpty());
CHECK(try_catch.HasCaught());
@@ -11223,7 +11223,7 @@ TEST(ObjectProtoToStringES6) {
obj.As<v8::Object>()->SetAccessor(
toStringTag, SymbolAccessorGetterReturnsDefault, 0, v8_str("Test"));
{
- TryCatch try_catch;
+ TryCatch try_catch(isolate);
value = obj.As<v8::Object>()->ObjectProtoToString();
CHECK(value->IsString() && value->Equals(v8_str("[object Test]")));
CHECK(!try_catch.HasCaught());
@@ -11232,7 +11232,7 @@ TEST(ObjectProtoToStringES6) {
// JS @@toStringTag value
obj = CompileRun("obj = {}; obj[Symbol.toStringTag] = 'Test'; obj");
{
- TryCatch try_catch;
+ TryCatch try_catch(isolate);
value = obj.As<v8::Object>()->ObjectProtoToString();
CHECK(value->IsString() && value->Equals(v8_str("[object Test]")));
CHECK(!try_catch.HasCaught());
@@ -11244,7 +11244,7 @@ TEST(ObjectProtoToStringES6) {
" get: function() { throw 'Test'; }"
"}); obj");
{
- TryCatch try_catch;
+ TryCatch try_catch(isolate);
value = obj.As<v8::Object>()->ObjectProtoToString();
CHECK(value.IsEmpty());
CHECK(try_catch.HasCaught());
@@ -11256,7 +11256,7 @@ TEST(ObjectProtoToStringES6) {
" get: function() { return 'Test'; }"
"}); obj");
{
- TryCatch try_catch;
+ TryCatch try_catch(isolate);
value = obj.As<v8::Object>()->ObjectProtoToString();
CHECK(value->IsString() && value->Equals(v8_str("[object Test]")));
CHECK(!try_catch.HasCaught());
@@ -11470,7 +11470,8 @@ static void ThrowInJS(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Locker nested_locker(isolate);
v8::HandleScope scope(isolate);
v8::Handle<Value> exception;
- { v8::TryCatch try_catch;
+ {
+ v8::TryCatch try_catch(isolate);
v8::Handle<Value> value = CompileRun(code);
CHECK(value.IsEmpty());
CHECK(try_catch.HasCaught());
@@ -12496,7 +12497,7 @@ THREADED_TEST(Regress54) {
TEST(CatchStackOverflow) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
v8::Handle<v8::Value> result = CompileRun(
"function f() {"
" return f();"
@@ -12511,7 +12512,7 @@ static void CheckTryCatchSourceInfo(v8::Handle<v8::Script> script,
const char* resource_name,
int line_offset) {
v8::HandleScope scope(CcTest::isolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(CcTest::isolate());
v8::Handle<v8::Value> result = script->Run();
CHECK(result.IsEmpty());
CHECK(try_catch.HasCaught());
@@ -12571,7 +12572,7 @@ THREADED_TEST(TryCatchSourceInfo) {
THREADED_TEST(TryCatchSourceInfoForEOSError) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
v8::Script::Compile(v8_str("!\n"));
CHECK(try_catch.HasCaught());
v8::Handle<v8::Message> message = try_catch.Message();
@@ -13155,7 +13156,7 @@ TEST(RegExpInterruption) {
regexp_interruption_data.string_resource = new UC16VectorResource(
i::Vector<const i::uc16>(uc16_content, i::StrLength(one_byte_content)));
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(CcTest::isolate());
timeout_thread.Start();
CompileRun("/((a*)*)*b/.exec(a)");
@@ -14101,7 +14102,7 @@ THREADED_TEST(ScriptContextDependence) {
THREADED_TEST(StackTrace) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
const char *source = "function foo() { FAIL.FAIL; }; foo();";
v8::Handle<v8::String> src =
v8::String::NewFromUtf8(context->GetIsolate(), source);
@@ -15080,7 +15081,7 @@ TEST(DynamicWithSourceURLInStackTraceString) {
i::ScopedVector<char> code(1024);
i::SNPrintF(code, source, "//# sourceURL=source_url");
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
CompileRunWithOrigin(code.start(), "", 0, 0);
CHECK(try_catch.HasCaught());
v8::String::Utf8Value stack(try_catch.StackTrace());
@@ -15101,7 +15102,7 @@ TEST(EvalWithSourceURLInMessageScriptResourceNameOrSourceURL) {
"outer();\n"
"//# sourceURL=outer_url";
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
CompileRun(source);
CHECK(try_catch.HasCaught());
@@ -15125,7 +15126,7 @@ TEST(RecursionWithSourceURLInMessageScriptResourceNameOrSourceURL) {
"outer();\n"
"//# sourceURL=outer_url";
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
CompileRun(source);
CHECK(try_catch.HasCaught());
@@ -15491,7 +15492,7 @@ THREADED_TEST(QuietSignalingNaNs) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
// Special double values.
double snan = DoubleFromBits(0x7ff00000, 0x00000001);
@@ -15578,7 +15579,7 @@ THREADED_TEST(QuietSignalingNaNs) {
static void SpaghettiIncident(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::HandleScope scope(args.GetIsolate());
- v8::TryCatch tc;
+ v8::TryCatch tc(args.GetIsolate());
v8::Handle<v8::String> str(args[0]->ToString(args.GetIsolate()));
USE(str);
if (tc.HasCaught())
@@ -15595,7 +15596,7 @@ THREADED_TEST(SpaghettiStackReThrow) {
context->Global()->Set(
v8::String::NewFromUtf8(isolate, "s"),
v8::FunctionTemplate::New(isolate, SpaghettiIncident)->GetFunction());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"var i = 0;"
"var o = {"
@@ -15681,7 +15682,7 @@ TEST(Regress528) {
v8::Local<Context> context = Context::New(isolate);
context->Enter();
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(source_exception);
CHECK(try_catch.HasCaught());
v8::Handle<v8::Message> message = try_catch.Message();
@@ -17294,7 +17295,7 @@ TEST(RegExp) {
v8::Handle<v8::Value> value(CompileRun("re.property"));
CHECK_EQ(32, value->Int32Value());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(context->GetIsolate());
re = v8::RegExp::New(v8_str("foo["), v8::RegExp::kNone);
CHECK(re.IsEmpty());
CHECK(try_catch.HasCaught());
@@ -17634,7 +17635,7 @@ void CheckCodeGenerationAllowed() {
void CheckCodeGenerationDisallowed() {
- TryCatch try_catch;
+ TryCatch try_catch(CcTest::isolate());
Handle<Value> result = CompileRun("eval('42')");
CHECK(result.IsEmpty());
@@ -17697,7 +17698,7 @@ THREADED_TEST(AllowCodeGenFromStrings) {
TEST(SetErrorMessageForCodeGenFromStrings) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- TryCatch try_catch;
+ TryCatch try_catch(context->GetIsolate());
Handle<String> message = v8_str("Message") ;
Handle<String> expected_message = v8_str("Uncaught EvalError: Message");
@@ -17724,7 +17725,7 @@ THREADED_TEST(CallAPIFunctionOnNonObject) {
v8::FunctionTemplate::New(isolate, NonObjectThis);
Handle<Function> function = templ->GetFunction();
context->Global()->Set(v8_str("f"), function);
- TryCatch try_catch;
+ TryCatch try_catch(isolate);
CompileRun("f.call(2)");
}
@@ -18173,7 +18174,7 @@ TEST(RunMicrotasksIgnoresThrownExceptions) {
Function::New(isolate, MicrotaskExceptionOne));
isolate->EnqueueMicrotask(
Function::New(isolate, MicrotaskExceptionTwo));
- TryCatch try_catch;
+ TryCatch try_catch(isolate);
CompileRun("1+1;");
CHECK(!try_catch.HasCaught());
CHECK_EQ(1, CompileRun("exception1Calls")->Int32Value());
@@ -18494,7 +18495,7 @@ static void CheckInstanceCheckedResult(int getters, int setters,
static void CheckInstanceCheckedAccessors(bool expects_callbacks) {
instance_checked_getter_count = 0;
instance_checked_setter_count = 0;
- TryCatch try_catch;
+ TryCatch try_catch(CcTest::isolate());
// Test path through generic runtime code.
CompileRun("obj.foo");
@@ -18642,7 +18643,7 @@ TEST(TryFinallyMessage) {
// Test that the original error message is not lost if there is a
// recursive call into Javascript is done in the finally block, e.g. to
// initialize an IC. (crbug.com/129171)
- TryCatch try_catch;
+ TryCatch try_catch(context->GetIsolate());
const char* trigger_ic =
"try { \n"
" throw new Error('test'); \n"
@@ -18660,7 +18661,7 @@ TEST(TryFinallyMessage) {
{
// Test that the original exception message is indeed overwritten if
// a new error is thrown in the finally block.
- TryCatch try_catch;
+ TryCatch try_catch(context->GetIsolate());
const char* throw_again =
"try { \n"
" throw new Error('test'); \n"
@@ -18830,7 +18831,7 @@ THREADED_TEST(Regress137496) {
// Compile a try-finally clause where the finally block causes a GC
// while there still is a message pending for external reporting.
- TryCatch try_catch;
+ TryCatch try_catch(context->GetIsolate());
try_catch.SetVerbose(true);
CompileRun("try { throw new Error(); } finally { gc(); }");
CHECK(try_catch.HasCaught());
@@ -19102,7 +19103,8 @@ TEST(AccessCheckThrows) {
context1->Global()->Set(v8_str("has_own_property"),
has_own_property_fun->GetFunction());
- { v8::TryCatch try_catch;
+ {
+ v8::TryCatch try_catch(isolate);
access_check_fail_thrown = false;
CompileRun("other.x;");
CHECK(access_check_fail_thrown);
@@ -19719,7 +19721,7 @@ class ApiCallOptimizationChecker {
"%%OptimizeFunctionOnNextCall(wrap_set_%d);\n"
"check(wrap_set());\n",
wrap_function.start(), key, key, key, key, key, key);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(source.start());
DCHECK(!try_catch.HasCaught());
CHECK_EQ(9, count);
@@ -20143,7 +20145,7 @@ TEST(ThrowOnJavascriptExecution) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
v8::Isolate::DisallowJavascriptExecutionScope throw_js(
isolate, v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
CompileRun("1+1");
@@ -20203,7 +20205,7 @@ TEST(CaptureStackTraceForStackOverflow) {
v8::HandleScope scope(isolate);
V8::SetCaptureStackTraceForUncaughtExceptions(
true, 10, v8::StackTrace::kDetailed);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun("(function f(x) { f(x+1); })(0)");
CHECK(try_catch.HasCaught());
}
@@ -20444,7 +20446,7 @@ void RunStreamingTest(const char** chunks,
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
v8::ScriptCompiler::StreamedSource source(new TestSourceStream(chunks),
encoding);
@@ -20816,7 +20818,7 @@ TEST(StreamingWithHarmonyScopes) {
// variable again.
const char* chunks[] = {"\"use strict\"; let x = 2;", NULL};
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
v8::ScriptCompiler::StreamedSource source(
new TestSourceStream(chunks),
v8::ScriptCompiler::StreamedSource::ONE_BYTE);
@@ -20931,7 +20933,7 @@ TEST(StringConcatOverflow) {
new RandomLengthOneByteResource(i::String::kMaxLength);
v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), r);
CHECK(!str.IsEmpty());
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(CcTest::isolate());
v8::Local<v8::String> result = v8::String::Concat(str, str);
CHECK(result.IsEmpty());
CHECK(!try_catch.HasCaught());
@@ -20992,7 +20994,7 @@ TEST(GetPrototypeAccessControl) {
env->Global()->Set(v8_str("prohibited"), obj_template->NewInstance());
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
CompileRun(
"function f() { %_GetPrototype(prohibited); }"
"%OptimizeFunctionOnNextCall(f);"
@@ -21076,21 +21078,21 @@ TEST(NewStringRangeError) {
if (buffer == NULL) return;
memset(buffer, 'A', buffer_size);
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
char* data = reinterpret_cast<char*>(buffer);
CHECK(v8::String::NewFromUtf8(isolate, data, v8::String::kNormalString,
length).IsEmpty());
CHECK(!try_catch.HasCaught());
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
uint8_t* data = reinterpret_cast<uint8_t*>(buffer);
CHECK(v8::String::NewFromOneByte(isolate, data, v8::String::kNormalString,
length).IsEmpty());
CHECK(!try_catch.HasCaught());
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
uint16_t* data = reinterpret_cast<uint16_t*>(buffer);
CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString,
length).IsEmpty());
@@ -21139,7 +21141,7 @@ TEST(StrongModeArityCallFromApi) {
v8::HandleScope scope(isolate);
Local<Function> fun;
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
fun = Local<Function>::Cast(CompileRun(
"function f(x) { 'use strong'; }"
"f"));
@@ -21148,20 +21150,20 @@ TEST(StrongModeArityCallFromApi) {
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
fun->Call(v8::Undefined(isolate), 0, nullptr);
CHECK(try_catch.HasCaught());
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
v8::Handle<Value> args[] = {v8_num(42)};
fun->Call(v8::Undefined(isolate), arraysize(args), args);
CHECK(!try_catch.HasCaught());
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
v8::Handle<Value> args[] = {v8_num(42), v8_num(555)};
fun->Call(v8::Undefined(isolate), arraysize(args), args);
CHECK(!try_catch.HasCaught());
@@ -21176,7 +21178,7 @@ TEST(StrongModeArityCallFromApi2) {
v8::HandleScope scope(isolate);
Local<Function> fun;
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
fun = Local<Function>::Cast(CompileRun(
"'use strong';"
"function f(x) {}"
@@ -21186,20 +21188,20 @@ TEST(StrongModeArityCallFromApi2) {
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
fun->Call(v8::Undefined(isolate), 0, nullptr);
CHECK(try_catch.HasCaught());
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
v8::Handle<Value> args[] = {v8_num(42)};
fun->Call(v8::Undefined(isolate), arraysize(args), args);
CHECK(!try_catch.HasCaught());
}
{
- v8::TryCatch try_catch;
+ v8::TryCatch try_catch(isolate);
v8::Handle<Value> args[] = {v8_num(42), v8_num(555)};
fun->Call(v8::Undefined(isolate), arraysize(args), args);
CHECK(!try_catch.HasCaught());
« no previous file with comments | « test/cctest/test-accessors.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698