summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_context.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-06 14:22:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-06 14:22:39 +0000
commit8ae320912348c162d2b90f1dc7b7528999bbb305 (patch)
treeffb203604cdb7bc5e8583c81106a98928a8d067f /fxjs/cfxjse_context.cpp
parent74ed5542fdde125d62b040dd63b0f6c69e7ae234 (diff)
downloadpdfium-8ae320912348c162d2b90f1dc7b7528999bbb305.tar.xz
Better error reporting on XFA JS errors
Change-Id: I773ff83b45ffbd736f064daedb1010c8d01a99d5 Reviewed-on: https://pdfium-review.googlesource.com/34050 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cfxjse_context.cpp')
-rw-r--r--fxjs/cfxjse_context.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 2de698d3ed..01f86c37be 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -293,7 +293,16 @@ bool CFXJSE_Context::ExecuteScript(const char* szScript,
#ifndef NDEBUG
v8::String::Utf8Value error(GetIsolate(), trycatch.Exception());
- fprintf(stderr, "JS Error: %ls\n", WideString::FromUTF8(*error).c_str());
+ fprintf(stderr, "JS Error: %s\n", *error);
+
+ v8::Local<v8::Message> message = trycatch.Message();
+ if (!message.IsEmpty()) {
+ v8::Local<v8::Context> context(GetIsolate()->GetCurrentContext());
+ int linenum = message->GetLineNumber(context).FromJust();
+ v8::String::Utf8Value sourceline(
+ GetIsolate(), message->GetSourceLine(context).ToLocalChecked());
+ fprintf(stderr, "Line %d: %s\n", linenum, *sourceline);
+ }
#endif // NDEBUG
if (lpRetValue) {