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

Side by Side Diff: test/cctest/test-api.cc

Issue 171042: Added API call to get the stack trace for an exception (Closed)
Patch Set: Created 11 years, 4 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 unified diff | Download patch
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7735 matching lines...) Expand 10 before | Expand all | Expand 10 after
7746 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); 7746 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source));
7747 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); 7747 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source));
7748 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); 7748 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100));
7749 CHECK_EQ(dep->Run()->Int32Value(), 100); 7749 CHECK_EQ(dep->Run()->Int32Value(), 100);
7750 CHECK_EQ(indep->Run()->Int32Value(), 100); 7750 CHECK_EQ(indep->Run()->Int32Value(), 100);
7751 LocalContext c2; 7751 LocalContext c2;
7752 c2->Global()->Set(v8::String::New("foo"), v8::Integer::New(101)); 7752 c2->Global()->Set(v8::String::New("foo"), v8::Integer::New(101));
7753 CHECK_EQ(dep->Run()->Int32Value(), 100); 7753 CHECK_EQ(dep->Run()->Int32Value(), 100);
7754 CHECK_EQ(indep->Run()->Int32Value(), 101); 7754 CHECK_EQ(indep->Run()->Int32Value(), 101);
7755 } 7755 }
7756
7757 THREADED_TEST(StackTrace) {
7758 v8::HandleScope scope;
7759 LocalContext context;
7760 v8::TryCatch try_catch;
7761 const char *source = "function foo() { FAIL.FAIL; }; foo();";
7762 v8::Handle<v8::String> src = v8::String::New(source);
7763 v8::Handle<v8::String> origin = v8::String::New("stack-trace-test");
7764 v8::Script::New(src, origin)->Run();
7765 CHECK(try_catch.HasCaught());
7766 v8::String::Utf8Value stack(try_catch.StackTrace());
7767 CHECK(strstr(*stack, "at foo (stack-trace-test") != NULL);
7768 }
OLDNEW
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698