summaryrefslogtreecommitdiff
path: root/xfa/fxjse/context.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxjse/context.cpp')
-rw-r--r--xfa/fxjse/context.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/xfa/fxjse/context.cpp b/xfa/fxjse/context.cpp
index b125177617..76df5616e5 100644
--- a/xfa/fxjse/context.cpp
+++ b/xfa/fxjse/context.cpp
@@ -11,28 +11,17 @@
#include "xfa/fxjse/util_inline.h"
#include "xfa/fxjse/value.h"
-namespace {
-
-CFXJSE_Context* CFXContextFromHContext(FXJSE_HCONTEXT hContext) {
- return reinterpret_cast<CFXJSE_Context*>(hContext);
-}
-
-} // namespace
-
-FXJSE_HCONTEXT FXJSE_Context_Create(v8::Isolate* pIsolate,
- const FXJSE_CLASS* lpGlobalClass,
- void* lpGlobalObject) {
- CFXJSE_Context* pContext =
- CFXJSE_Context::Create(pIsolate, lpGlobalClass, lpGlobalObject);
- return reinterpret_cast<FXJSE_HCONTEXT>(pContext);
+CFXJSE_Context* FXJSE_Context_Create(v8::Isolate* pIsolate,
+ const FXJSE_CLASS* lpGlobalClass,
+ void* lpGlobalObject) {
+ return CFXJSE_Context::Create(pIsolate, lpGlobalClass, lpGlobalObject);
}
-void FXJSE_Context_Release(FXJSE_HCONTEXT hContext) {
- delete CFXContextFromHContext(hContext);
+void FXJSE_Context_Release(CFXJSE_Context* pContext) {
+ delete pContext;
}
-FXJSE_HVALUE FXJSE_Context_GetGlobalObject(FXJSE_HCONTEXT hContext) {
- CFXJSE_Context* pContext = CFXContextFromHContext(hContext);
+FXJSE_HVALUE FXJSE_Context_GetGlobalObject(CFXJSE_Context* pContext) {
if (!pContext)
return nullptr;
@@ -68,20 +57,19 @@ static const FX_CHAR* szCompatibleModeScripts[] = {
" }\n"
" }\n"
"}(this, {String: ['substr', 'toUpperCase']}));"};
-void FXJSE_Context_EnableCompatibleMode(FXJSE_HCONTEXT hContext,
+void FXJSE_Context_EnableCompatibleMode(CFXJSE_Context* pContext,
uint32_t dwCompatibleFlags) {
for (uint32_t i = 0; i < (uint32_t)FXJSE_COMPATIBLEMODEFLAGCOUNT; i++) {
if (dwCompatibleFlags & (1 << i)) {
- FXJSE_ExecuteScript(hContext, szCompatibleModeScripts[i], NULL, NULL);
+ FXJSE_ExecuteScript(pContext, szCompatibleModeScripts[i], NULL, NULL);
}
}
}
-FX_BOOL FXJSE_ExecuteScript(FXJSE_HCONTEXT hContext,
+FX_BOOL FXJSE_ExecuteScript(CFXJSE_Context* pContext,
const FX_CHAR* szScript,
FXJSE_HVALUE hRetValue,
FXJSE_HVALUE hNewThisObject) {
- CFXJSE_Context* pContext = CFXContextFromHContext(hContext);
return pContext->ExecuteScript(
szScript, reinterpret_cast<CFXJSE_Value*>(hRetValue),
reinterpret_cast<CFXJSE_Value*>(hNewThisObject));