Remove v8::Context slot usage entierly from fxjs

Its no longer required.

Change-Id: I180ca99817352a91b6d9d7c9b45985cd96dc730e
Reviewed-on: https://pdfium-review.googlesource.com/34290
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index 5d0f3b0..763a3d9 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -15,11 +15,6 @@
 
 class CFXJS_PerObjectData;
 
-// Keep this consistent with the values defined in gin/public/context_holder.h
-// (without actually requiring a dependency on gin itself for the standalone
-// embedders of PDFIum). The value we want to use is:
-//   kPerContextDataStartIndex + kEmbedderPDFium, which is 3.
-static const unsigned int kPerContextDataIndex = 3u;
 static unsigned int g_embedderDataSlot = 1u;
 static v8::Isolate* g_isolate = nullptr;
 static size_t g_isolate_ref_count = 0;
@@ -297,18 +292,6 @@
 CFXJS_Engine::~CFXJS_Engine() = default;
 
 // static
-CFXJS_Engine* CFXJS_Engine::EngineFromIsolateCurrentContext(
-    v8::Isolate* pIsolate) {
-  return EngineFromContext(pIsolate->GetCurrentContext());
-}
-
-// static
-CFXJS_Engine* CFXJS_Engine::EngineFromContext(v8::Local<v8::Context> pContext) {
-  return static_cast<CFXJS_Engine*>(
-      pContext->GetAlignedPointerFromEmbedderData(kPerContextDataIndex));
-}
-
-// static
 int CFXJS_Engine::GetObjDefnID(v8::Local<v8::Object> pObj) {
   CFXJS_PerObjectData* pData = CFXJS_PerObjectData::GetFromObject(pObj);
   return pData ? pData->m_ObjDefID : -1;
@@ -332,10 +315,6 @@
   delete pData;
 }
 
-void CFXJS_Engine::SetIntoContext(v8::Local<v8::Context> pContext) {
-  pContext->SetAlignedPointerInEmbedderData(kPerContextDataIndex, this);
-}
-
 int CFXJS_Engine::DefineObj(const char* sObjName,
                             FXJSOBJTYPE eObjType,
                             CFXJS_Engine::Constructor pConstructor,
@@ -451,7 +430,6 @@
   }
 
   v8::Context::Scope context_scope(v8Context);
-  SetIntoContext(v8Context);
 
   int maxID = CFXJS_ObjDefinition::MaxID(GetIsolate());
   m_StaticObjects.resize(maxID + 1);
diff --git a/fxjs/cfxjs_engine.h b/fxjs/cfxjs_engine.h
index 0c9d70d..a5f9476 100644
--- a/fxjs/cfxjs_engine.h
+++ b/fxjs/cfxjs_engine.h
@@ -81,17 +81,12 @@
       std::function<void(CFXJS_Engine* pEngine, v8::Local<v8::Object> obj)>;
   using Destructor = std::function<void(v8::Local<v8::Object> obj)>;
 
-  static CFXJS_Engine* EngineFromIsolateCurrentContext(v8::Isolate* pIsolate);
-  static CFXJS_Engine* EngineFromContext(v8::Local<v8::Context> pContext);
-
   static int GetObjDefnID(v8::Local<v8::Object> pObj);
   static CJS_Object* GetObjectPrivate(v8::Local<v8::Object> pObj);
   static void SetObjectPrivate(v8::Local<v8::Object> pObj,
                                std::unique_ptr<CJS_Object> p);
   static void FreeObjectPrivate(v8::Local<v8::Object> pObj);
 
-  void SetIntoContext(v8::Local<v8::Context> pContext);
-
   // Always returns a valid, newly-created objDefnID.
   int DefineObj(const char* sObjName,
                 FXJSOBJTYPE eObjType,
diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp
index 01f86c3..59cb4af 100644
--- a/fxjs/cfxjse_context.cpp
+++ b/fxjs/cfxjse_context.cpp
@@ -153,7 +153,6 @@
 // static
 std::unique_ptr<CFXJSE_Context> CFXJSE_Context::Create(
     v8::Isolate* pIsolate,
-    CFXJS_Engine* pOptionalEngineToSet,
     const FXJSE_CLASS_DESCRIPTOR* pGlobalClass,
     CFXJSE_HostObject* pGlobalObject) {
   CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
@@ -196,9 +195,6 @@
 
   v8::Local<v8::Object> hGlobalObject = GetGlobalObjectFromContext(hNewContext);
   FXJSE_UpdateObjectBinding(hGlobalObject, pGlobalObject);
-  if (pOptionalEngineToSet)
-    pOptionalEngineToSet->SetIntoContext(hNewContext);
-
   pContext->m_hContext.Reset(pIsolate, hNewContext);
   return pContext;
 }
diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h
index 0f4c97a..8ab9551 100644
--- a/fxjs/cfxjse_context.h
+++ b/fxjs/cfxjse_context.h
@@ -22,7 +22,6 @@
  public:
   static std::unique_ptr<CFXJSE_Context> Create(
       v8::Isolate* pIsolate,
-      CFXJS_Engine* pOptionalEngineToSet,
       const FXJSE_CLASS_DESCRIPTOR* pGlobalClass,
       CFXJSE_HostObject* pGlobalObject);
 
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 2361a64..21aed70 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -99,7 +99,6 @@
       m_pSubordinateRuntime(fxjs_runtime),
       m_pDocument(pDocument),
       m_JsContext(CFXJSE_Context::Create(fxjs_runtime->GetIsolate(),
-                                         fxjs_runtime,
                                          &GlobalClassDescriptor,
                                          pDocument->GetRoot())),
       m_pJsClass(nullptr),
@@ -464,9 +463,9 @@
   if (!pScriptNode || !pSubform)
     return nullptr;
 
-  auto pNewContext = CFXJSE_Context::Create(
-      GetIsolate(), m_pSubordinateRuntime.Get(), &VariablesClassDescriptor,
-      new CXFA_ThisProxy(pSubform, pScriptNode));
+  auto pNewContext =
+      CFXJSE_Context::Create(GetIsolate(), &VariablesClassDescriptor,
+                             new CXFA_ThisProxy(pSubform, pScriptNode));
   RemoveBuiltInObjs(pNewContext.get());
   pNewContext->EnableCompatibleMode();
   CFXJSE_Context* pResult = pNewContext.get();
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index 6a938a5..181d9a1 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -2839,7 +2839,7 @@
   }
 
   std::unique_ptr<CFXJSE_Context> pNewContext(
-      CFXJSE_Context::Create(pIsolate, nullptr, nullptr, nullptr));
+      CFXJSE_Context::Create(pIsolate, nullptr, nullptr));
 
   auto returnValue = pdfium::MakeUnique<CFXJSE_Value>(pIsolate);
   pNewContext->ExecuteScript(