OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4315 v8::V8::Initialize(); | 4315 v8::V8::Initialize(); |
4316 LocalContext context; | 4316 LocalContext context; |
4317 v8::HandleScope scope(context->GetIsolate()); | 4317 v8::HandleScope scope(context->GetIsolate()); |
4318 v8::TryCatch try_catch; | 4318 v8::TryCatch try_catch; |
4319 TryCatchNestedHelper(5); | 4319 TryCatchNestedHelper(5); |
4320 CHECK(try_catch.HasCaught()); | 4320 CHECK(try_catch.HasCaught()); |
4321 CHECK_EQ(0, strcmp(*v8::String::Utf8Value(try_catch.Exception()), "back")); | 4321 CHECK_EQ(0, strcmp(*v8::String::Utf8Value(try_catch.Exception()), "back")); |
4322 } | 4322 } |
4323 | 4323 |
4324 | 4324 |
| 4325 v8::Handle<Value> TryCatchNestedSyntaxHelper(const v8::Arguments& args) { |
| 4326 ApiTestFuzzer::Fuzz(); |
| 4327 v8::TryCatch try_catch; |
| 4328 v8::ScriptOrigin origin(v8::String::New("inner"), |
| 4329 v8::Integer::New(1), v8::Integer::New(1)); |
| 4330 v8::Script::Compile(v8::String::New("invalid ?= 1;\n"), &origin); |
| 4331 CHECK(try_catch.HasCaught()); |
| 4332 return try_catch.ReThrow(); |
| 4333 } |
| 4334 |
| 4335 |
| 4336 // This test ensures that an outer TryCatch in the following situation: |
| 4337 // C++/TryCatch -> JS -> C++/TryCatch -> JS w/ SyntaxError |
| 4338 // does clobber the Message object generated for the inner TryCatch. |
| 4339 // This exercises the ability of TryCatch.ReThrow() to restore the |
| 4340 // inner pending Message before throwing the exception again. |
| 4341 TEST(TryCatchNestedSyntax) { |
| 4342 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 4343 v8::V8::Initialize(); |
| 4344 v8::TryCatch try_catch; |
| 4345 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 4346 templ->Set(v8_str("TryCatchNestedSyntaxHelper"), |
| 4347 v8::FunctionTemplate::New(TryCatchNestedSyntaxHelper)); |
| 4348 LocalContext context(0, templ); |
| 4349 CompileRunWithOrigin("TryCatchNestedSyntaxHelper();\n", "outer", 1, 1); |
| 4350 CHECK(try_catch.HasCaught()); |
| 4351 Handle<Value> resource = try_catch.Message()->GetScriptResourceName(); |
| 4352 CHECK_EQ(0, strcmp(*v8::String::Utf8Value(resource), "inner")); |
| 4353 } |
| 4354 |
| 4355 |
4325 THREADED_TEST(Equality) { | 4356 THREADED_TEST(Equality) { |
4326 LocalContext context; | 4357 LocalContext context; |
4327 v8::Isolate* isolate = context->GetIsolate(); | 4358 v8::Isolate* isolate = context->GetIsolate(); |
4328 v8::HandleScope scope(context->GetIsolate()); | 4359 v8::HandleScope scope(context->GetIsolate()); |
4329 // Check that equality works at all before relying on CHECK_EQ | 4360 // Check that equality works at all before relying on CHECK_EQ |
4330 CHECK(v8_str("a")->Equals(v8_str("a"))); | 4361 CHECK(v8_str("a")->Equals(v8_str("a"))); |
4331 CHECK(!v8_str("a")->Equals(v8_str("b"))); | 4362 CHECK(!v8_str("a")->Equals(v8_str("b"))); |
4332 | 4363 |
4333 CHECK_EQ(v8_str("a"), v8_str("a")); | 4364 CHECK_EQ(v8_str("a"), v8_str("a")); |
4334 CHECK_NE(v8_str("a"), v8_str("b")); | 4365 CHECK_NE(v8_str("a"), v8_str("b")); |
(...skipping 14748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
19083 i::Semaphore* sem_; | 19114 i::Semaphore* sem_; |
19084 volatile int sem_value_; | 19115 volatile int sem_value_; |
19085 }; | 19116 }; |
19086 | 19117 |
19087 | 19118 |
19088 THREADED_TEST(SemaphoreInterruption) { | 19119 THREADED_TEST(SemaphoreInterruption) { |
19089 ThreadInterruptTest().RunTest(); | 19120 ThreadInterruptTest().RunTest(); |
19090 } | 19121 } |
19091 | 19122 |
19092 #endif // WIN32 | 19123 #endif // WIN32 |
OLD | NEW |