diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-06 14:22:39 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-06 14:22:39 +0000 |
commit | 8ae320912348c162d2b90f1dc7b7528999bbb305 (patch) | |
tree | ffb203604cdb7bc5e8583c81106a98928a8d067f | |
parent | 74ed5542fdde125d62b040dd63b0f6c69e7ae234 (diff) | |
download | pdfium-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>
-rw-r--r-- | fxjs/cfxjse_context.cpp | 11 |
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) { |