summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-31 21:03:51 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-31 21:03:51 +0000
commit430fcb2955c48d0046518faea5afde91c5c0ce60 (patch)
tree11b3527661e7e55830b5caa7e4d552d797530375
parent1118a66bfe024e137324075ac4d9433b9425e373 (diff)
downloadpdfium-430fcb2955c48d0046518faea5afde91c5c0ce60.tar.xz
Make FXJSE variable context compatible with FXJS.
Allows FXJS to be entered directly from V8 when the variable context gets a reference to an FXJS object. Bug: pdfium:1066 Change-Id: I48e39ed9104cc6df31c19d94fa7e0f8c7760932f Reviewed-on: https://pdfium-review.googlesource.com/33450 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
-rw-r--r--fxjs/cfxjse_engine.cpp7
-rw-r--r--fxjs/cfxjse_engine.h1
2 files changed, 5 insertions, 3 deletions
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index ff2bcc4618..6c8830923f 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -96,6 +96,7 @@ CXFA_Object* CFXJSE_Engine::ToObject(CFXJSE_Value* pValue,
CFXJSE_Engine::CFXJSE_Engine(CXFA_Document* pDocument,
CFXJS_Engine* fxjs_engine)
: CFX_V8(fxjs_engine->GetIsolate()),
+ m_pSubordinateEngine(fxjs_engine),
m_pDocument(pDocument),
m_JsContext(CFXJSE_Context::Create(fxjs_engine->GetIsolate(),
fxjs_engine,
@@ -447,9 +448,9 @@ CFXJSE_Context* CFXJSE_Engine::CreateVariablesContext(CXFA_Node* pScriptNode,
if (!pScriptNode || !pSubform)
return nullptr;
- auto pNewContext =
- CFXJSE_Context::Create(GetIsolate(), nullptr, &VariablesClassDescriptor,
- new CXFA_ThisProxy(pSubform, pScriptNode));
+ auto pNewContext = CFXJSE_Context::Create(
+ GetIsolate(), m_pSubordinateEngine.Get(), &VariablesClassDescriptor,
+ new CXFA_ThisProxy(pSubform, pScriptNode));
RemoveBuiltInObjs(pNewContext.get());
pNewContext->EnableCompatibleMode();
CFXJSE_Context* pResult = pNewContext.get();
diff --git a/fxjs/cfxjse_engine.h b/fxjs/cfxjse_engine.h
index 33723ad8a9..dc05f0ddf8 100644
--- a/fxjs/cfxjse_engine.h
+++ b/fxjs/cfxjse_engine.h
@@ -107,6 +107,7 @@ class CFXJSE_Engine : public CFX_V8 {
bool bGetter);
bool RunVariablesScript(CXFA_Node* pScriptNode);
+ UnownedPtr<CFXJS_Engine> const m_pSubordinateEngine;
UnownedPtr<CXFA_Document> const m_pDocument;
std::unique_ptr<CFXJSE_Context> m_JsContext;
CFXJSE_Class* m_pJsClass;