OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 10547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10558 v8::Handle<Value> AnalyzeStackOfEvalWithSourceURL(const v8::Arguments& args) { | 10558 v8::Handle<Value> AnalyzeStackOfEvalWithSourceURL(const v8::Arguments& args) { |
10559 v8::HandleScope scope; | 10559 v8::HandleScope scope; |
10560 v8::Handle<v8::StackTrace> stackTrace = | 10560 v8::Handle<v8::StackTrace> stackTrace = |
10561 v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); | 10561 v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); |
10562 CHECK_EQ(5, stackTrace->GetFrameCount()); | 10562 CHECK_EQ(5, stackTrace->GetFrameCount()); |
10563 v8::Handle<v8::String> url = v8_str("eval_url"); | 10563 v8::Handle<v8::String> url = v8_str("eval_url"); |
10564 for (int i = 0; i < 3; i++) { | 10564 for (int i = 0; i < 3; i++) { |
10565 v8::Handle<v8::String> name = | 10565 v8::Handle<v8::String> name = |
10566 stackTrace->GetFrame(i)->GetScriptNameOrSourceURL(); | 10566 stackTrace->GetFrame(i)->GetScriptNameOrSourceURL(); |
10567 CHECK(!name.IsEmpty()); | 10567 CHECK(!name.IsEmpty()); |
10568 CHECK_EQ(url, name); | 10568 CHECK_EQ(url, name); |
10569 } | 10569 } |
10570 return v8::Undefined(); | 10570 return v8::Undefined(); |
10571 } | 10571 } |
10572 | 10572 |
10573 | 10573 |
10574 TEST(SourceURLInStackTrace) { | 10574 TEST(SourceURLInStackTrace) { |
10575 v8::HandleScope scope; | 10575 v8::HandleScope scope; |
10576 Local<ObjectTemplate> templ = ObjectTemplate::New(); | 10576 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
10577 templ->Set(v8_str("AnalyzeStackOfEvalWithSourceURL"), | 10577 templ->Set(v8_str("AnalyzeStackOfEvalWithSourceURL"), |
10578 v8::FunctionTemplate::New(AnalyzeStackOfEvalWithSourceURL)); | 10578 v8::FunctionTemplate::New(AnalyzeStackOfEvalWithSourceURL)); |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11709 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase | | 11709 static_cast<v8::RegExp::Flags>(v8::RegExp::kIgnoreCase | |
11710 v8::RegExp::kMultiline)); | 11710 v8::RegExp::kMultiline)); |
11711 CHECK(re->IsRegExp()); | 11711 CHECK(re->IsRegExp()); |
11712 CHECK(re->GetSource()->Equals(v8_str("foobarbaz"))); | 11712 CHECK(re->GetSource()->Equals(v8_str("foobarbaz"))); |
11713 CHECK_EQ(static_cast<int>(re->GetFlags()), | 11713 CHECK_EQ(static_cast<int>(re->GetFlags()), |
11714 v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline); | 11714 v8::RegExp::kIgnoreCase | v8::RegExp::kMultiline); |
11715 | 11715 |
11716 context->Global()->Set(v8_str("re"), re); | 11716 context->Global()->Set(v8_str("re"), re); |
11717 ExpectTrue("re.test('FoobarbaZ')"); | 11717 ExpectTrue("re.test('FoobarbaZ')"); |
11718 } | 11718 } |
OLD | NEW |