Make built-in JS console compatible with Adobe's console.

console.show() and console.println() are calls commonly found in XFA
scripts. This CL adds methods to the built-in V8 console so these calls
do not stop the rest of script from running.

Bug: chromium:872893
Change-Id: I661f505176884558ae2d658312d561a28767ae25
Reviewed-on: https://pdfium-review.googlesource.com/41533
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 6c5a95f..5d40f6f 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -42,6 +42,13 @@
     "  }\n"
     "}(this, {String: ['substr', 'toUpperCase']}));";
 
+const char szConsoleScript[] =
+    "console.show = function() {};\n"
+    "\n"
+    "console.println = function(...args) {\n"
+    "  this.log(...args);\n"
+    "};";
+
 // Only address matters, values are for humans debuging here.
 char g_FXJSEHostObjectTag[] = "FXJSE Host Object";
 char g_FXJSEProxyObjectTag[] = "FXJSE Proxy Object";
@@ -221,6 +228,7 @@
 
 void CFXJSE_Context::EnableCompatibleMode() {
   ExecuteScript(szCompatibleModeScript, nullptr, nullptr);
+  ExecuteScript(szConsoleScript, nullptr, nullptr);
 }
 
 bool CFXJSE_Context::ExecuteScript(const char* szScript,