summaryrefslogtreecommitdiff
path: root/fxjs/fxjs_v8.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-02-07 21:07:24 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-02-07 21:07:24 +0000
commit9ad9a5fc81a36ab406ff49408dd0814d350bbc7e (patch)
treeec46a8cbec08c17d5932bd330c4fd4b5baa2c180 /fxjs/fxjs_v8.cpp
parent161f992a81e400eeebba49387f174d836750d624 (diff)
downloadpdfium-9ad9a5fc81a36ab406ff49408dd0814d350bbc7e.tar.xz
Split creation of ordinary object and bound objects in FXJS.chromium/3343
One can be performed by the CJS_V8 layer, the other requires the full FXJS mechanism. Avoids using -1 as a special case. Change-Id: I4a14ccb6a7fea393f84b70a07ada03b1a83c7d36 Reviewed-on: https://pdfium-review.googlesource.com/25830 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/fxjs_v8.cpp')
-rw-r--r--fxjs/fxjs_v8.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index 773f9025b1..8a04a0680e 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -414,7 +414,7 @@ void CFXJS_Engine::InitializeEngine() {
}
} else if (pObjDef->m_ObjType == FXJSOBJTYPE_STATIC) {
v8::Local<v8::String> pObjName = NewString(pObjDef->m_ObjName);
- v8::Local<v8::Object> obj = NewFxDynamicObj(i, true);
+ v8::Local<v8::Object> obj = NewFXJSBoundObject(i, true);
if (!obj.IsEmpty()) {
v8Context->Global()->Set(v8Context, pObjName, obj).FromJust();
m_StaticObjects[i] = v8::Global<v8::Object>(GetIsolate(), obj);
@@ -484,19 +484,10 @@ int CFXJS_Engine::Execute(const WideString& script, FXJSErr* pError) {
return 0;
}
-v8::Local<v8::Object> CFXJS_Engine::NewFxDynamicObj(int nObjDefnID,
- bool bStatic) {
+v8::Local<v8::Object> CFXJS_Engine::NewFXJSBoundObject(int nObjDefnID,
+ bool bStatic) {
v8::Isolate::Scope isolate_scope(GetIsolate());
v8::Local<v8::Context> context = GetIsolate()->GetCurrentContext();
- if (nObjDefnID == -1) {
- v8::Local<v8::ObjectTemplate> objTempl =
- v8::ObjectTemplate::New(GetIsolate());
- v8::Local<v8::Object> obj;
- if (!objTempl->NewInstance(context).ToLocal(&obj))
- return v8::Local<v8::Object>();
- return obj;
- }
-
FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(GetIsolate());
if (!pData)
return v8::Local<v8::Object>();