summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-05-30 18:09:31 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-30 18:09:31 +0000
commit0789714191b4b3109f7d5c415663090018e27577 (patch)
tree38663b1c39425e833e5cd3aa76c01e078aa88375
parentf0d9d28a034fe3650c3c2d662090c1e8687ddb16 (diff)
downloadpdfium-0789714191b4b3109f7d5c415663090018e27577.tar.xz
[xfa] Dump JS errors to console in debug modechromium/3446
This CL writes any JS exceptions to the console in XFA if running in Debug mode. This makes it possible to see when an error happens in JS execution. Bug: pdfium:1097 Change-Id: Ida14050328c5e6e85ab2704bb5dddfec370dddf1 Reviewed-on: https://pdfium-review.googlesource.com/33154 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--fxjs/cfxjse_context.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 03bcc4d6ab..6f2b770bdc 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -293,9 +293,16 @@ bool CFXJSE_Context::ExecuteScript(const char* szScript,
ASSERT(!trycatch.HasCaught());
if (lpRetValue)
lpRetValue->m_hValue.Reset(m_pIsolate, hValue);
+
return true;
}
}
+
+#ifndef NDEBUG
+ v8::String::Utf8Value error(GetIsolate(), trycatch.Exception());
+ fprintf(stderr, "JS Error: %ls\n", WideString::FromUTF8(*error).c_str());
+#endif // NDEBUG
+
if (lpRetValue) {
lpRetValue->m_hValue.Reset(m_pIsolate,
CreateReturnValue(m_pIsolate, trycatch));