OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 5303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5314 " return f();" | 5314 " return f();" |
5315 "}" | 5315 "}" |
5316 "" | 5316 "" |
5317 "f();")); | 5317 "f();")); |
5318 v8::Handle<v8::Value> result = script->Run(); | 5318 v8::Handle<v8::Value> result = script->Run(); |
5319 CHECK(result.IsEmpty()); | 5319 CHECK(result.IsEmpty()); |
5320 } | 5320 } |
5321 | 5321 |
5322 | 5322 |
5323 static void CheckTryCatchSourceInfo(v8::Handle<v8::Script> script, | 5323 static void CheckTryCatchSourceInfo(v8::Handle<v8::Script> script, |
5324 char* resource_name, | 5324 const char* resource_name, |
5325 int line_offset) { | 5325 int line_offset) { |
5326 v8::HandleScope scope; | 5326 v8::HandleScope scope; |
5327 v8::TryCatch try_catch; | 5327 v8::TryCatch try_catch; |
5328 v8::Handle<v8::Value> result = script->Run(); | 5328 v8::Handle<v8::Value> result = script->Run(); |
5329 CHECK(result.IsEmpty()); | 5329 CHECK(result.IsEmpty()); |
5330 CHECK(try_catch.HasCaught()); | 5330 CHECK(try_catch.HasCaught()); |
5331 v8::Handle<v8::Message> message = try_catch.Message(); | 5331 v8::Handle<v8::Message> message = try_catch.Message(); |
5332 CHECK(!message.IsEmpty()); | 5332 CHECK(!message.IsEmpty()); |
5333 CHECK_EQ(10 + line_offset, message->GetLineNumber()); | 5333 CHECK_EQ(10 + line_offset, message->GetLineNumber()); |
5334 CHECK_EQ(91, message->GetStartPosition()); | 5334 CHECK_EQ(91, message->GetStartPosition()); |
(...skipping 18 matching lines...) Expand all Loading... |
5353 "function Bar() {\n" | 5353 "function Bar() {\n" |
5354 " return Baz();\n" | 5354 " return Baz();\n" |
5355 "}\n" | 5355 "}\n" |
5356 "\n" | 5356 "\n" |
5357 "function Baz() {\n" | 5357 "function Baz() {\n" |
5358 " throw 'nirk';\n" | 5358 " throw 'nirk';\n" |
5359 "}\n" | 5359 "}\n" |
5360 "\n" | 5360 "\n" |
5361 "Foo();\n"); | 5361 "Foo();\n"); |
5362 | 5362 |
5363 char* resource_name; | 5363 const char* resource_name; |
5364 v8::Handle<v8::Script> script; | 5364 v8::Handle<v8::Script> script; |
5365 resource_name = "test.js"; | 5365 resource_name = "test.js"; |
5366 script = v8::Script::Compile(source, v8::String::New(resource_name)); | 5366 script = v8::Script::Compile(source, v8::String::New(resource_name)); |
5367 CheckTryCatchSourceInfo(script, resource_name, 0); | 5367 CheckTryCatchSourceInfo(script, resource_name, 0); |
5368 | 5368 |
5369 resource_name = "test1.js"; | 5369 resource_name = "test1.js"; |
5370 v8::ScriptOrigin origin1(v8::String::New(resource_name)); | 5370 v8::ScriptOrigin origin1(v8::String::New(resource_name)); |
5371 script = v8::Script::Compile(source, &origin1); | 5371 script = v8::Script::Compile(source, &origin1); |
5372 CheckTryCatchSourceInfo(script, resource_name, 0); | 5372 CheckTryCatchSourceInfo(script, resource_name, 0); |
5373 | 5373 |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5792 | 5792 |
5793 // Local context should still be live. | 5793 // Local context should still be live. |
5794 CHECK(!local_env.IsEmpty()); | 5794 CHECK(!local_env.IsEmpty()); |
5795 local_env->Enter(); | 5795 local_env->Enter(); |
5796 | 5796 |
5797 // Should complete without problems. | 5797 // Should complete without problems. |
5798 RegExpInterruptTest().RunTest(); | 5798 RegExpInterruptTest().RunTest(); |
5799 | 5799 |
5800 local_env->Exit(); | 5800 local_env->Exit(); |
5801 } | 5801 } |
OLD | NEW |