Cleanup CJS_Value

This CL removes unused methods; renames Attach to Set and generally cleans up
the CJS_Value classes.

Change-Id: I858082100908f3bc51f4b58c11ceda3357fadc70
Reviewed-on: https://pdfium-review.googlesource.com/16430
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index b82020d..109c0ec 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -81,7 +81,7 @@
   if (iSize < 1)
     return false;
 
-  std::wstring unsafe_fmt_string(params[0].ToCFXWideString(pRuntime).c_str());
+  std::wstring unsafe_fmt_string(params[0].ToWideString(pRuntime).c_str());
   std::vector<std::wstring> unsafe_conversion_specifiers;
   int iOffset = 0;
   int iOffend = 0;
@@ -122,7 +122,7 @@
         break;
       case UTIL_STRING:
         strSegment.Format(c_strFormat.c_str(),
-                          params[iIndex].ToCFXWideString(pRuntime).c_str());
+                          params[iIndex].ToWideString(pRuntime).c_str());
         break;
       default:
         strSegment.Format(L"%ls", c_strFormat.c_str());
@@ -146,12 +146,12 @@
 
   const CJS_Value& p1 = params[0];
   const CJS_Value& p2 = params[1];
-  CJS_Date jsDate;
-  if (!p2.ConvertToDate(pRuntime, jsDate)) {
+  if (!p2.IsDateObject()) {
     sError = JSGetStringFromID(IDS_STRING_JSPRINT1);
     return false;
   }
 
+  CJS_Date jsDate = p2.ToDate(pRuntime);
   if (!jsDate.IsValidDate(pRuntime)) {
     sError = JSGetStringFromID(IDS_STRING_JSPRINT2);
     return false;
@@ -197,7 +197,7 @@
 
     // Convert PDF-style format specifiers to wcsftime specifiers. Remove any
     // pre-existing %-directives before inserting our own.
-    std::basic_string<wchar_t> cFormat = p1.ToCFXWideString(pRuntime).c_str();
+    std::basic_string<wchar_t> cFormat = p1.ToWideString(pRuntime).c_str();
     cFormat.erase(std::remove(cFormat.begin(), cFormat.end(), '%'),
                   cFormat.end());
 
@@ -276,8 +276,8 @@
     return false;
   }
 
-  vRet = CJS_Value(pRuntime, printx(params[0].ToCFXWideString(pRuntime),
-                                    params[1].ToCFXWideString(pRuntime))
+  vRet = CJS_Value(pRuntime, printx(params[0].ToWideString(pRuntime),
+                                    params[1].ToWideString(pRuntime))
                                  .c_str());
 
   return true;
@@ -388,8 +388,8 @@
   if (params.size() < 2)
     return false;
 
-  WideString sFormat = params[0].ToCFXWideString(pRuntime);
-  WideString sDate = params[1].ToCFXWideString(pRuntime);
+  WideString sFormat = params[0].ToWideString(pRuntime);
+  WideString sDate = params[1].ToWideString(pRuntime);
   double dDate = JS_GetDateTime();
   if (sDate.GetLength() > 0) {
     dDate = CJS_PublicMethods::MakeRegularDate(sDate, sFormat, nullptr);