summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-06 11:45:28 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-06 11:45:28 -0700
commitcd56a7d6fb05bd0babf316a84280a26ecc649d45 (patch)
tree65a4ff0aa976f364e46d1ec69ebbe34ddbc99e90 /fpdfsdk/src/javascript/JS_Runtime.cpp
parent3745841a4c4ab915c98865c1dd71f9debc3e2f99 (diff)
downloadpdfium-cd56a7d6fb05bd0babf316a84280a26ecc649d45.tar.xz
Merge to XFA: Store object definition ID in each js_class.
Manual edits in JS_Define.h. (cherry picked from commit f0a5b2803c09f3605dcd606e764ef604f0d2a8ea) Original Review URL: https://codereview.chromium.org/1382263002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1382683008 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 563576a9d6..f206154029 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -109,34 +109,34 @@ void CJS_Runtime::DefineJSObjects() {
// The call order determines the "ObjDefID" assigned to each class.
// ObjDefIDs 0 - 2
- CJS_Border::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Display::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Font::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Border::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Display::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Font::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
// ObjDefIDs 3 - 5
- CJS_Highlight::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Position::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_ScaleHow::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Highlight::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Position::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_ScaleHow::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
// ObjDefIDs 6 - 8
- CJS_ScaleWhen::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Style::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Zoomtype::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_ScaleWhen::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Style::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Zoomtype::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
// ObjDefIDs 9 - 11
- CJS_App::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Color::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Console::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_App::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Color::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Console::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
// ObjDefIDs 12 - 14
- CJS_Document::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
- CJS_Event::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Field::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
+ CJS_Document::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_GLOBAL);
+ CJS_Event::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Field::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_DYNAMIC);
// ObjDefIDs 15 - 17
- CJS_Global::DefineJSObjects(GetIsolate(), FXJS_STATIC);
- CJS_Icon::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
- CJS_Util::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Global::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
+ CJS_Icon::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_DYNAMIC);
+ CJS_Util::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_STATIC);
// ObjDefIDs 18 - 20 (these can't fail, return void).
CJS_PublicMethods::DefineJSObjects(GetIsolate());
@@ -144,8 +144,8 @@ void CJS_Runtime::DefineJSObjects() {
CJS_GlobalArrays::DefineJSObjects(GetIsolate());
// ObjDefIDs 21 - 22.
- CJS_TimerObj::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
- CJS_PrintParamsObj::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
+ CJS_TimerObj::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_DYNAMIC);
+ CJS_PrintParamsObj::DefineJSObjects(GetIsolate(), FXJSOBJTYPE_DYNAMIC);
}
IFXJS_Context* CJS_Runtime::NewContext() {
@@ -185,8 +185,7 @@ void CJS_Runtime::SetReaderDocument(CPDFSDK_Document* pReaderDoc) {
if (pReaderDoc) {
v8::Local<v8::Object> pThis = FXJS_GetThisObj(GetIsolate());
if (!pThis.IsEmpty()) {
- if (FXJS_GetObjDefnID(pThis) ==
- FXJS_GetObjDefnID(GetIsolate(), L"Document")) {
+ if (FXJS_GetObjDefnID(pThis) == CJS_Document::g_nObjDefnID) {
if (CJS_Document* pJSDocument =
(CJS_Document*)FXJS_GetPrivate(GetIsolate(), pThis)) {
if (Document* pDocument = (Document*)pJSDocument->GetEmbedObject())