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

Unified Diff: test/cctest/test-api.cc

Issue 23536007: Add scriptId to StackTrace frames. (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index ccf1cbd9514b528175bdae7e410ed4cd9180d175..91f377a1fdb2285a07ded9315349afb8cabe29f8 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -16665,6 +16665,42 @@ TEST(SourceURLInStackTrace) {
}
+static int scriptIdInStack[2];
+
+void AnalyzeScriptIdInStack(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ v8::HandleScope scope(args.GetIsolate());
+ v8::Handle<v8::StackTrace> stackTrace =
+ v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kScriptId);
+ CHECK_EQ(2, stackTrace->GetFrameCount());
+ for (int i = 0; i < 2; i++) {
+ scriptIdInStack[i] = stackTrace->GetFrame(i)->GetScriptId();
yurys 2013/08/30 13:07:25 Instead of using global array to collect script id
+ }
+}
+
+
+TEST(ScriptIdInStackTrace) {
+ v8::HandleScope scope(v8::Isolate::GetCurrent());
+ Local<ObjectTemplate> templ = ObjectTemplate::New();
+ templ->Set(v8_str("AnalyzeScriptIdInStack"),
+ v8::FunctionTemplate::New(AnalyzeScriptIdInStack));
+ LocalContext context(0, templ);
+
+ v8::Handle<v8::String> scriptSource = v8::String::New(
+ "function foo() {\n"
+ " AnalyzeScriptIdInStack();"
+ "}\n"
+ "foo();\n");
+ v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
+ v8::Local<v8::Script> script(v8::Script::Compile(scriptSource, &origin));
+ script->Run();
+ for (int i = 0; i < 2; i++) {
+ CHECK(scriptIdInStack[i] != v8::Message::kNoScriptIdInfo);
+ CHECK_EQ(scriptIdInStack[i], script->GetId());
+ }
+}
+
+
void AnalyzeStackOfInlineScriptWithSourceURL(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::HandleScope scope(args.GetIsolate());
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698