Update all callsites of the TryCatch ctor to pass an Isolate
BUG=4134 R=vogelheim@chromium.org LOG=n Review URL: https://codereview.chromium.org/1154423004 Cr-Commit-Position: refs/heads/master@{#28678}
This commit is contained in:
parent
ce2b39f2f2
commit
5df3b4ab5c
@ -220,7 +220,7 @@ bool JsHttpRequestProcessor::ExecuteScript(Handle<String> script) {
|
||||
|
||||
// We're just about to compile the script; set up an error handler to
|
||||
// catch any exceptions the script might throw.
|
||||
TryCatch try_catch;
|
||||
TryCatch try_catch(GetIsolate());
|
||||
|
||||
// Compile the script and check for errors.
|
||||
Handle<Script> compiled_script = Script::Compile(script);
|
||||
@ -281,7 +281,7 @@ bool JsHttpRequestProcessor::Process(HttpRequest* request) {
|
||||
Handle<Object> request_obj = WrapRequest(request);
|
||||
|
||||
// Set up an exception handler before calling the Process function
|
||||
TryCatch try_catch;
|
||||
TryCatch try_catch(GetIsolate());
|
||||
|
||||
// Invoke the process function, giving the global object as 'this'
|
||||
// and one argument, the request.
|
||||
|
@ -325,7 +325,7 @@ bool ExecuteString(v8::Isolate* isolate,
|
||||
bool print_result,
|
||||
bool report_exceptions) {
|
||||
v8::HandleScope handle_scope(isolate);
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
v8::ScriptOrigin origin(name);
|
||||
v8::Handle<v8::Script> script = v8::Script::Compile(source, &origin);
|
||||
if (script.IsEmpty()) {
|
||||
|
12
src/api.cc
12
src/api.cc
@ -305,7 +305,7 @@ bool RunExtraCode(Isolate* isolate, const char* utf8_source) {
|
||||
// Run custom script if provided.
|
||||
base::ElapsedTimer timer;
|
||||
timer.Start();
|
||||
TryCatch try_catch;
|
||||
TryCatch try_catch(isolate);
|
||||
Local<String> source_string = String::NewFromUtf8(isolate, utf8_source);
|
||||
if (try_catch.HasCaught()) return false;
|
||||
ScriptOrigin origin(String::NewFromUtf8(isolate, "<embedded script>"));
|
||||
@ -7473,11 +7473,12 @@ void Isolate::VisitHandlesForPartialDependence(
|
||||
String::Utf8Value::Utf8Value(v8::Handle<v8::Value> obj)
|
||||
: str_(NULL), length_(0) {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate);
|
||||
if (obj.IsEmpty()) return;
|
||||
ENTER_V8(isolate);
|
||||
i::HandleScope scope(isolate);
|
||||
TryCatch try_catch;
|
||||
Handle<String> str = obj->ToString(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
TryCatch try_catch(v8_isolate);
|
||||
Handle<String> str = obj->ToString(v8_isolate);
|
||||
if (str.IsEmpty()) return;
|
||||
i::Handle<i::String> i_str = Utils::OpenHandle(*str);
|
||||
length_ = v8::Utf8Length(*i_str, isolate);
|
||||
@ -7494,11 +7495,12 @@ String::Utf8Value::~Utf8Value() {
|
||||
String::Value::Value(v8::Handle<v8::Value> obj)
|
||||
: str_(NULL), length_(0) {
|
||||
i::Isolate* isolate = i::Isolate::Current();
|
||||
Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate);
|
||||
if (obj.IsEmpty()) return;
|
||||
ENTER_V8(isolate);
|
||||
i::HandleScope scope(isolate);
|
||||
TryCatch try_catch;
|
||||
Handle<String> str = obj->ToString(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
TryCatch try_catch(v8_isolate);
|
||||
Handle<String> str = obj->ToString(v8_isolate);
|
||||
if (str.IsEmpty()) return;
|
||||
length_ = str->Length();
|
||||
str_ = i::NewArray<uint16_t>(length_ + 1);
|
||||
|
@ -25,7 +25,7 @@ void HandleDebugEvent(const Debug::EventDetails& event_details) {
|
||||
return;
|
||||
}
|
||||
|
||||
TryCatch try_catch;
|
||||
TryCatch try_catch(isolate);
|
||||
|
||||
// Get the toJSONProtocol function on the event and get the JSON format.
|
||||
Local<String> to_json_fun_name =
|
||||
@ -76,7 +76,7 @@ void HandleDebugEvent(const Debug::EventDetails& event_details) {
|
||||
// Ignore empty commands.
|
||||
if (strlen(command) == 0) continue;
|
||||
|
||||
TryCatch try_catch;
|
||||
TryCatch try_catch(isolate);
|
||||
|
||||
// Convert the debugger command to a JSON debugger request.
|
||||
Handle<Value> request = Shell::DebugCommandToJSONRequest(
|
||||
|
@ -307,7 +307,7 @@ bool Shell::ExecuteString(Isolate* isolate, Handle<String> source,
|
||||
bool FLAG_debugger = false;
|
||||
#endif // !V8_SHARED
|
||||
HandleScope handle_scope(isolate);
|
||||
TryCatch try_catch;
|
||||
TryCatch try_catch(isolate);
|
||||
options.script_executed = true;
|
||||
if (FLAG_debugger) {
|
||||
// When debugging make exceptions appear to be uncaught.
|
||||
@ -352,7 +352,7 @@ bool Shell::ExecuteString(Isolate* isolate, Handle<String> source,
|
||||
}
|
||||
#if !defined(V8_SHARED)
|
||||
} else {
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
v8::Local<v8::Context> context =
|
||||
v8::Local<v8::Context>::New(isolate, utility_context_);
|
||||
v8::Context::Scope context_scope(context);
|
||||
@ -571,7 +571,7 @@ void Shell::Write(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
}
|
||||
|
||||
// Explicitly catch potential exceptions in toString().
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(args.GetIsolate());
|
||||
Handle<String> str_obj = args[i]->ToString(args.GetIsolate());
|
||||
if (try_catch.HasCaught()) {
|
||||
try_catch.ReThrow();
|
||||
|
@ -200,7 +200,7 @@ MaybeHandle<Object> Execution::TryCall(Handle<JSFunction> func,
|
||||
// creating message objects during stack overflow we shouldn't
|
||||
// capture messages.
|
||||
{
|
||||
v8::TryCatch catcher;
|
||||
v8::TryCatch catcher(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
catcher.SetVerbose(false);
|
||||
catcher.SetCaptureMessage(false);
|
||||
|
||||
|
@ -844,7 +844,7 @@ MaybeHandle<JSArray> LiveEdit::GatherCompileInfo(Handle<Script> script,
|
||||
{
|
||||
// Creating verbose TryCatch from public API is currently the only way to
|
||||
// force code save location. We do not use this the object directly.
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
try_catch.SetVerbose(true);
|
||||
|
||||
// A logical 'try' section.
|
||||
|
@ -112,7 +112,7 @@ void MessageHandler::ReportMessage(Isolate* isolate, MessageLocation* loc,
|
||||
Handle<Object> callback_data(listener.get(1), isolate);
|
||||
{
|
||||
// Do not allow exceptions to propagate.
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
callback(api_message_obj, callback_data->IsUndefined()
|
||||
? api_exception_obj
|
||||
: v8::Utils::ToLocal(callback_data));
|
||||
|
@ -58,7 +58,7 @@ RUNTIME_FUNCTION(Runtime_DeliverObservationChangeRecords) {
|
||||
DCHECK(args.length() == 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, argument, 1);
|
||||
v8::TryCatch catcher;
|
||||
v8::TryCatch catcher(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
// We should send a message on uncaught exception thrown during
|
||||
// Object.observe delivery while not interrupting further delivery, thus
|
||||
// we make a call inside a verbose TryCatch.
|
||||
|
@ -63,7 +63,7 @@ class FunctionTester : public InitializedHandleScope {
|
||||
}
|
||||
|
||||
void CheckThrows(Handle<Object> a, Handle<Object> b) {
|
||||
TryCatch try_catch;
|
||||
TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
MaybeHandle<Object> no_result = Call(a, b);
|
||||
CHECK(isolate->has_pending_exception());
|
||||
CHECK(try_catch.HasCaught());
|
||||
@ -73,7 +73,7 @@ class FunctionTester : public InitializedHandleScope {
|
||||
|
||||
v8::Handle<v8::Message> CheckThrowsReturnMessage(Handle<Object> a,
|
||||
Handle<Object> b) {
|
||||
TryCatch try_catch;
|
||||
TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate));
|
||||
MaybeHandle<Object> no_result = Call(a, b);
|
||||
CHECK(isolate->has_pending_exception());
|
||||
CHECK(try_catch.HasCaught());
|
||||
|
@ -552,7 +552,7 @@ THREADED_TEST(AccessorPropertyCrossContext) {
|
||||
v8::Handle<v8::Function> fun = v8::Function::New(isolate, check_contexts);
|
||||
LocalContext switch_context;
|
||||
switch_context->Global()->Set(v8_str("fun"), fun);
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
expected_current_context = env.local();
|
||||
expected_calling_context = switch_context.local();
|
||||
CompileRun(
|
||||
|
@ -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());
|
||||
|
@ -211,7 +211,7 @@ static int SetScriptBreakPointByIdFromJS(v8::Isolate* isolate, int script_id,
|
||||
}
|
||||
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
|
||||
{
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
v8::Handle<v8::String> str =
|
||||
v8::String::NewFromUtf8(isolate, buffer.start());
|
||||
v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run();
|
||||
@ -240,7 +240,7 @@ static int SetScriptBreakPointByNameFromJS(v8::Isolate* isolate,
|
||||
}
|
||||
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
|
||||
{
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
v8::Handle<v8::String> str =
|
||||
v8::String::NewFromUtf8(isolate, buffer.start());
|
||||
v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run();
|
||||
@ -4023,7 +4023,7 @@ TEST(EvalJSInDebugEventListenerOnNativeReThrownException) {
|
||||
|
||||
// ReThrow native error
|
||||
{
|
||||
v8::TryCatch tryCatch;
|
||||
v8::TryCatch tryCatch(env->GetIsolate());
|
||||
env->GetIsolate()->ThrowException(v8::Exception::TypeError(
|
||||
v8::String::NewFromUtf8(env->GetIsolate(), "Type error")));
|
||||
CHECK(tryCatch.HasCaught());
|
||||
@ -5602,7 +5602,7 @@ static void CheckDataParameter(
|
||||
CHECK(v8::Debug::Call(debugger_call_with_data, data)->IsString());
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
v8::TryCatch catcher;
|
||||
v8::TryCatch catcher(args.GetIsolate());
|
||||
CHECK(v8::Debug::Call(debugger_call_with_data).IsEmpty());
|
||||
CHECK(catcher.HasCaught());
|
||||
CHECK(catcher.Exception()->IsString());
|
||||
@ -7267,7 +7267,7 @@ static void DebugEventStepNext(
|
||||
|
||||
|
||||
static void RunScriptInANewCFrame(const char* source) {
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(CcTest::isolate());
|
||||
CompileRun(source);
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
@ -7447,7 +7447,7 @@ TEST(DebugBreakOffThreadTerminate) {
|
||||
v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate);
|
||||
TerminationThread terminator(isolate);
|
||||
terminator.Start();
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(env->GetIsolate());
|
||||
v8::Debug::DebugBreak(isolate);
|
||||
CompileRun("while (true);");
|
||||
CHECK(try_catch.HasTerminated());
|
||||
@ -7463,7 +7463,7 @@ static void DebugEventExpectNoException(
|
||||
|
||||
static void TryCatchWrappedThrowCallback(
|
||||
const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(args.GetIsolate());
|
||||
CompileRun("throw 'rejection';");
|
||||
CHECK(try_catch.HasCaught());
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ void DeclarationContext::Check(const char* source,
|
||||
// to avoid that.
|
||||
CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
|
||||
HandleScope scope(CcTest::isolate());
|
||||
TryCatch catcher;
|
||||
TryCatch catcher(CcTest::isolate());
|
||||
catcher.SetVerbose(true);
|
||||
Local<Script> script =
|
||||
Script::Compile(String::NewFromUtf8(CcTest::isolate(), source));
|
||||
@ -567,7 +567,7 @@ class SimpleContext {
|
||||
Expectations expectations,
|
||||
v8::Handle<Value> value = Local<Value>()) {
|
||||
HandleScope scope(context_->GetIsolate());
|
||||
TryCatch catcher;
|
||||
TryCatch catcher(context_->GetIsolate());
|
||||
catcher.SetVerbose(true);
|
||||
Local<Script> script =
|
||||
Script::Compile(String::NewFromUtf8(context_->GetIsolate(), source));
|
||||
|
@ -37,7 +37,7 @@ TEST(StrictUndeclaredGlobalVariable) {
|
||||
HandleScope scope(CcTest::isolate());
|
||||
v8::Local<v8::String> var_name = v8_str("x");
|
||||
LocalContext context;
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(CcTest::isolate());
|
||||
v8::Local<v8::Script> script = v8_compile("\"use strict\"; x = 42;");
|
||||
v8::Handle<v8::Object> proto = v8::Object::New(CcTest::isolate());
|
||||
v8::Handle<v8::Object> global =
|
||||
|
@ -5346,7 +5346,7 @@ TEST(PreprocessStackTrace) {
|
||||
FLAG_gc_interval = -1;
|
||||
CcTest::InitializeVM();
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(CcTest::isolate());
|
||||
CompileRun("throw new Error();");
|
||||
CHECK(try_catch.HasCaught());
|
||||
Isolate* isolate = CcTest::i_isolate();
|
||||
@ -5420,7 +5420,7 @@ TEST(Regress1878) {
|
||||
v8::Utils::ToLocal(CcTest::i_isolate()->internal_array_function());
|
||||
CcTest::global()->Set(v8_str("InternalArray"), constructor);
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
|
||||
CompileRun(
|
||||
"var a = Array();"
|
||||
|
@ -482,7 +482,7 @@ TEST(EquivalenceOfLoggingAndTraversal) {
|
||||
i::Vector<const char> source = TestSources::GetScriptsSource();
|
||||
v8::Handle<v8::String> source_str = v8::String::NewFromUtf8(
|
||||
isolate, source.start(), v8::String::kNormalString, source.length());
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
v8::Handle<v8::Script> script = CompileWithOrigin(source_str, "");
|
||||
if (script.IsEmpty()) {
|
||||
v8::String::Utf8Value exception(try_catch.Exception());
|
||||
|
@ -1685,7 +1685,7 @@ TEST(StrictOctal) {
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(
|
||||
v8::Context::New(CcTest::isolate()));
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(CcTest::isolate());
|
||||
const char* script =
|
||||
"\"use strict\"; \n"
|
||||
"a = function() { \n"
|
||||
@ -6224,7 +6224,7 @@ TEST(StrongModeFreeVariablesDeclaredByPreviousScript) {
|
||||
v8::V8::Initialize();
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate()));
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(CcTest::isolate());
|
||||
|
||||
// Introduce a bunch of variables, in all language modes.
|
||||
const char* script1 =
|
||||
@ -6283,7 +6283,7 @@ TEST(StrongModeFreeVariablesDeclaredByLanguage) {
|
||||
v8::V8::Initialize();
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate()));
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(CcTest::isolate());
|
||||
|
||||
const char* script1 =
|
||||
"\"use strong\"; \n"
|
||||
@ -6299,7 +6299,7 @@ TEST(StrongModeFreeVariablesDeclaredInGlobalPrototype) {
|
||||
v8::V8::Initialize();
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate()));
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(CcTest::isolate());
|
||||
|
||||
const char* script1 = "this.__proto__.my_var = 0;\n";
|
||||
CompileRun(v8_str(script1));
|
||||
@ -6318,7 +6318,7 @@ TEST(StrongModeFreeVariablesNotDeclared) {
|
||||
v8::V8::Initialize();
|
||||
v8::HandleScope scope(CcTest::isolate());
|
||||
v8::Context::Scope context_scope(v8::Context::New(CcTest::isolate()));
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(CcTest::isolate());
|
||||
|
||||
// Test that referencing unintroduced variables in sloppy mode is ok.
|
||||
const char* script1 =
|
||||
@ -6335,7 +6335,7 @@ TEST(StrongModeFreeVariablesNotDeclared) {
|
||||
"if (false) { \n"
|
||||
" not_there2; \n"
|
||||
"} \n";
|
||||
v8::TryCatch try_catch2;
|
||||
v8::TryCatch try_catch2(CcTest::isolate());
|
||||
v8::Script::Compile(v8_str(script2));
|
||||
CHECK(try_catch2.HasCaught());
|
||||
v8::String::Utf8Value exception(try_catch2.Exception());
|
||||
@ -6356,7 +6356,7 @@ TEST(StrongModeFreeVariablesNotDeclared) {
|
||||
" not_there3; \n"
|
||||
" } \n"
|
||||
"})(); \n";
|
||||
v8::TryCatch try_catch2;
|
||||
v8::TryCatch try_catch2(CcTest::isolate());
|
||||
v8::Script::Compile(v8_str(script3));
|
||||
CHECK(try_catch2.HasCaught());
|
||||
v8::String::Utf8Value exception(try_catch2.Exception());
|
||||
|
@ -1222,7 +1222,7 @@ UNINITIALIZED_TEST(OneByteArrayJoin) {
|
||||
// summing the lengths of the strings (as Smis) overflows and wraps.
|
||||
LocalContext context(isolate);
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
CHECK(CompileRun(
|
||||
"var two_14 = Math.pow(2, 14);"
|
||||
"var two_17 = Math.pow(2, 17);"
|
||||
|
@ -61,7 +61,7 @@ void Loop(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
|
||||
|
||||
void DoLoop(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(args.GetIsolate());
|
||||
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
|
||||
v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
|
||||
"function f() {"
|
||||
@ -86,7 +86,7 @@ void DoLoop(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
|
||||
|
||||
void DoLoopNoCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(args.GetIsolate());
|
||||
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
|
||||
v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
|
||||
"var term = true;"
|
||||
@ -217,7 +217,7 @@ void TerminateOrReturnObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
|
||||
|
||||
void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(args.GetIsolate());
|
||||
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
|
||||
v8::Script::Compile(
|
||||
v8::String::NewFromUtf8(args.GetIsolate(),
|
||||
@ -275,7 +275,7 @@ v8::Persistent<v8::String> reenter_script_1;
|
||||
v8::Persistent<v8::String> reenter_script_2;
|
||||
|
||||
void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(args.GetIsolate());
|
||||
v8::Isolate* isolate = args.GetIsolate();
|
||||
CHECK(!v8::V8::IsExecutionTerminating(isolate));
|
||||
v8::Local<v8::String> script =
|
||||
@ -328,7 +328,7 @@ TEST(TerminateAndReenterFromThreadItself) {
|
||||
|
||||
|
||||
void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(args.GetIsolate());
|
||||
CHECK(!v8::V8::IsExecutionTerminating());
|
||||
v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
|
||||
"var term = true;"
|
||||
@ -426,7 +426,7 @@ TEST(PostponeTerminateException) {
|
||||
v8::Context::New(CcTest::isolate(), NULL, global);
|
||||
v8::Context::Scope context_scope(context);
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
static const char* terminate_and_loop =
|
||||
"terminate(); for (var i = 0; i < 10000; i++);";
|
||||
|
||||
@ -504,7 +504,7 @@ TEST(TerminationInInnerTryCall) {
|
||||
v8::Context::New(CcTest::isolate(), NULL, global_template);
|
||||
v8::Context::Scope context_scope(context);
|
||||
{
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
CompileRun("inner_try_call_terminate()");
|
||||
CHECK(try_catch.HasTerminated());
|
||||
}
|
||||
@ -522,7 +522,7 @@ TEST(TerminateAndTryCall) {
|
||||
v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global);
|
||||
v8::Context::Scope context_scope(context);
|
||||
CHECK(!v8::V8::IsExecutionTerminating(isolate));
|
||||
v8::TryCatch try_catch;
|
||||
v8::TryCatch try_catch(isolate);
|
||||
CHECK(!v8::V8::IsExecutionTerminating(isolate));
|
||||
// Terminate execution has been triggered inside TryCall, but re-requested
|
||||
// to trigger later.
|
||||
|
Loading…
Reference in New Issue
Block a user