Wrap CFXJSE_Engine::GetJseContext() with GetJseContextForTest().

Then make GetJseContext() private since it is not used publicly
outside of tests.

Change-Id: I156c3e8bc42321a1fd4f7e59164caab77f5689a6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/99390
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/xfa/cfxjse_engine.h b/fxjs/xfa/cfxjse_engine.h
index ce8108e..8001224 100644
--- a/fxjs/xfa/cfxjse_engine.h
+++ b/fxjs/xfa/cfxjse_engine.h
@@ -130,7 +130,6 @@
 
   CXFA_Object* GetThisObject() const { return m_pThisObject; }
   CFXJSE_Class* GetJseNormalClass() const { return m_pJsClass.Get(); }
-  CFXJSE_Context* GetJseContext() const { return m_JsContext.get(); }
   CXFA_Document* GetDocument() const { return m_pDocument.Get(); }
 
   void SetNodesOfRunScript(std::vector<cppgc::Persistent<CXFA_Node>>* pArray);
@@ -149,7 +148,10 @@
 
   bool IsResolvingNodes() const { return m_bResolvingNodes; }
 
+  CFXJSE_Context* GetJseContextForTest() const { return GetJseContext(); }
+
  private:
+  CFXJSE_Context* GetJseContext() const { return m_JsContext.get(); }
   CFXJSE_Context* CreateVariablesContext(CXFA_Script* pScriptNode,
                                          CXFA_Node* pSubform);
   void RemoveBuiltInObjs(CFXJSE_Context* pContext);
diff --git a/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp b/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
index d53dad1..a158ce7 100644
--- a/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
+++ b/fxjs/xfa/cfxjse_formcalc_context_embeddertest.cpp
@@ -21,7 +21,7 @@
 
  protected:
   CFXJSE_Context* GetJseContext() {
-    return GetScriptContext()->GetJseContext();
+    return GetScriptContext()->GetJseContextForTest();
   }
 
   void ExecuteExpectError(ByteStringView input) {
diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp
index 475e984..d2c52e5 100644
--- a/testing/xfa_js_embedder_test.cpp
+++ b/testing/xfa_js_embedder_test.cpp
@@ -74,7 +74,8 @@
 }
 
 bool XFAJSEmbedderTest::Execute(ByteStringView input) {
-  CFXJSE_ScopeUtil_IsolateHandleContext scope(script_context_->GetJseContext());
+  CFXJSE_ScopeUtil_IsolateHandleContext scope(
+      script_context_->GetJseContextForTest());
   if (ExecuteHelper(input))
     return true;
 
@@ -97,7 +98,8 @@
 }
 
 bool XFAJSEmbedderTest::ExecuteSilenceFailure(ByteStringView input) {
-  CFXJSE_ScopeUtil_IsolateHandleContext scope(script_context_->GetJseContext());
+  CFXJSE_ScopeUtil_IsolateHandleContext scope(
+      script_context_->GetJseContextForTest());
   return ExecuteHelper(input);
 }