Index: fpdfsdk/src/javascript/JS_Runtime.cpp |
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp |
index fcf6ee879511d49aa2bad38e28cc8369559392e9..83e2c9af2a4984c8c6dafab01b6fe7b912a94684 100644 |
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp |
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp |
@@ -29,10 +29,17 @@ |
/* ------------------------------ CJS_Runtime ------------------------------ */ |
+// static |
IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) { |
return new CJS_Runtime(pEnv); |
} |
+// static |
+CJS_Runtime* CJS_Runtime::FromContext(const IJS_Context* cc) { |
+ const CJS_Context* pContext = static_cast<const CJS_Context*>(cc); |
+ return pContext->GetJSRuntime(); |
+} |
+ |
CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) |
: m_pApp(pApp), |
m_pDocument(NULL), |
@@ -115,8 +122,8 @@ void CJS_Runtime::DefineJSObjects() { |
// ObjDefIDs 18 - 20 (these can't fail, return void). |
CJS_PublicMethods::DefineJSObjects(GetIsolate()); |
- CJS_GlobalConsts::DefineJSObjects(GetIsolate()); |
- CJS_GlobalArrays::DefineJSObjects(GetIsolate()); |
+ CJS_GlobalConsts::DefineJSObjects(this); |
+ CJS_GlobalArrays::DefineJSObjects(this); |
// ObjDefIDs 21 - 22. |
CJS_TimerObj::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_DYNAMIC); |