Pass output parameters as pointers in ijs_event_context

It is hard to tell if there is some unsavory stuff going on with
references otherwise. Avoids some const_casts in the process.

Add some UnownedPtrs along the way to check caller's storage duration.

Change-Id: Ic8d85802083f0b27e07993ea25f8f1c15fca1712
Reviewed-on: https://pdfium-review.googlesource.com/35750
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 751a889..9d646b6 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -290,7 +290,7 @@
     WideString sValue = sOldValue;
     bool bRC = true;
     IJS_Runtime::ScopedEventContext pContext(pRuntime);
-    pContext->OnField_Calculate(pFormField, pField, sValue, bRC);
+    pContext->OnField_Calculate(pFormField, pField, &sValue, &bRC);
 
     Optional<IJS_Runtime::JS_Error> err = pContext->RunScript(csJS);
     if (!err && bRC && sValue.Compare(sOldValue) != 0)
@@ -324,7 +324,7 @@
       if (!script.IsEmpty()) {
         WideString Value = sValue;
         IJS_Runtime::ScopedEventContext pContext(pRuntime);
-        pContext->OnField_Format(pFormField, Value, true);
+        pContext->OnField_Format(pFormField, &Value, true);
         Optional<IJS_Runtime::JS_Error> err = pContext->RunScript(script);
         if (!err) {
           sValue = std::move(Value);