Commit 887bd285 authored by alph@chromium.org's avatar alph@chromium.org

Stack trace string should use dynamic script sourceURL if present.

BUG=v8:2342
R=dcarney@chromium.org, yurys@chromium.org, yurys
LOG=N

Review URL: https://codereview.chromium.org/143283015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19333 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 81347246
......@@ -939,14 +939,10 @@ function CallSiteToString() {
if (this.isNative()) {
fileLocation = "native";
} else {
if (this.isEval()) {
fileName = this.getScriptNameOrSourceURL();
if (!fileName) {
fileLocation = this.getEvalOrigin();
fileLocation += ", "; // Expecting source position to follow.
}
} else {
fileName = this.getFileName();
fileName = this.getScriptNameOrSourceURL();
if (!fileName && this.isEval()) {
fileLocation = this.getEvalOrigin();
fileLocation += ", "; // Expecting source position to follow.
}
if (fileName) {
......
......@@ -17520,6 +17520,29 @@ TEST(DynamicWithSourceURLInStackTrace) {
}
TEST(DynamicWithSourceURLInStackTraceString) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
const char *source =
"function outer() {\n"
" function foo() {\n"
" FAIL.FAIL;\n"
" }\n"
" foo();\n"
"}\n"
"outer()\n%s";
i::ScopedVector<char> code(1024);
i::OS::SNPrintF(code, source, "//# sourceURL=source_url");
v8::TryCatch try_catch;
CompileRunWithOrigin(code.start(), "", 0, 0);
CHECK(try_catch.HasCaught());
v8::String::Utf8Value stack(try_catch.StackTrace());
CHECK(strstr(*stack, "at foo (source_url:3:5)") != NULL);
}
static void CreateGarbageInOldSpace() {
i::Factory* factory = CcTest::i_isolate()->factory();
v8::HandleScope scope(CcTest::isolate());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment