Fix XFA objects printing as [object XFAObject]

A recent V8 change requires a @@toStringTag rather than just a class
attribute to be set. Keep both for the moment.

Change-Id: Ied154be07bf5cb6aaceac21a12458fd2d42c8ef2
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/69410
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/xfa/cfxjse_class.cpp b/fxjs/xfa/cfxjse_class.cpp
index 61215be..b411bcd 100644
--- a/fxjs/xfa/cfxjse_class.cpp
+++ b/fxjs/xfa/cfxjse_class.cpp
@@ -281,8 +281,12 @@
       pIsolate, bIsJSGlobal ? 0 : V8ConstructorCallback_Wrapper,
       v8::External::New(
           pIsolate, const_cast<FXJSE_CLASS_DESCRIPTOR*>(lpClassDefinition)));
-  hFunctionTemplate->SetClassName(
-      fxv8::NewStringHelper(pIsolate, lpClassDefinition->name));
+  v8::Local<v8::String> classname =
+      fxv8::NewStringHelper(pIsolate, lpClassDefinition->name);
+  hFunctionTemplate->SetClassName(classname);
+  hFunctionTemplate->PrototypeTemplate()->Set(
+      v8::Symbol::GetToStringTag(pIsolate), classname,
+      static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
   hFunctionTemplate->InstanceTemplate()->SetInternalFieldCount(2);
   v8::Local<v8::ObjectTemplate> hObjectTemplate =
       hFunctionTemplate->InstanceTemplate();