summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-09-17 15:25:23 -0700
committerTom Sepez <tsepez@chromium.org>2015-09-17 15:25:23 -0700
commit39bfe122b4867601051c56562a5ab9cf6be644ad (patch)
tree73ea2387759b2ba2a80ab344da69dc063fc69172 /fpdfsdk/src/javascript/JS_Runtime.cpp
parent4babdcf9c7abc9edefb179e5ed23db8e7a5840f7 (diff)
downloadpdfium-39bfe122b4867601051c56562a5ab9cf6be644ad.tar.xz
Merge to XFA: Ensure functions in FXJS_V8 are prefixed by FXJS_.
Manual edits: fpdfsdk/include/javascript/JS_Define.h fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp fpdfsdk/src/javascript/Document.cpp fpdfsdk/src/javascript/JS_Runtime.cpp fpdfsdk/src/jsapi/fxjs_v8.cpp (cherry picked from commit 506df426d5d64d68e9dc27ffebcf56f6c6a1bccf) Original Review URL: https://codereview.chromium.org/1347833002 . (cherry picked from commit 455019ca48f60bd285e043986471f51f17c69a0d) Original Review URL: https://codereview.chromium.org/1349783003 . (cherry picked from commit 1af240cc45480520b447be767686e73a29c48f9e) Original Review URL: https://codereview.chromium.org/1348693003 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1356563003 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index a85067be1b..bbe9f6e8c8 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -41,7 +41,7 @@ void CJS_RuntimeFactory::AddRef() {
void CJS_RuntimeFactory::Release() {
if (m_bInit) {
if (--m_nRef == 0) {
- JS_Release();
+ FXJS_Release();
m_bInit = FALSE;
}
}
@@ -69,7 +69,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
m_pApp->GetFormFillInfo()->m_pJsPlatform->m_isolate);
}
if (!m_isolate) {
- m_pArrayBufferAllocator.reset(new JS_ArrayBufferAllocator());
+ m_pArrayBufferAllocator.reset(new FXJS_ArrayBufferAllocator());
v8::Isolate::CreateParams params;
params.array_buffer_allocator = m_pArrayBufferAllocator.get();
@@ -83,7 +83,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
v8::HandleScope handle_scope(isolate);
if (CPDFXFA_App::GetInstance()->InitRuntime(FALSE)) {
CJS_Context* pContext = (CJS_Context*)NewContext();
- JS_InitializeRuntime(GetIsolate(), this, pContext, m_context);
+ FXJS_InitializeRuntime(GetIsolate(), this, pContext, m_context);
ReleaseContext(pContext);
return;
}
@@ -91,11 +91,11 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
unsigned int embedderDataSlot = 0;
if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2)
embedderDataSlot = pApp->GetFormFillInfo()->m_pJsPlatform->m_v8EmbedderSlot;
- JS_Initialize(embedderDataSlot);
+ FXJS_Initialize(embedderDataSlot);
DefineJSObjects();
CJS_Context* pContext = (CJS_Context*)NewContext();
- JS_InitializeRuntime(GetIsolate(), this, pContext, m_context);
+ FXJS_InitializeRuntime(GetIsolate(), this, pContext, m_context);
ReleaseContext(pContext);
}
@@ -105,7 +105,6 @@ CJS_Runtime::~CJS_Runtime() {
delete m_ContextArray.GetAt(i);
m_ContextArray.RemoveAll();
-
RemoveEventsInLoop(m_pFieldEventPath);
m_pApp = NULL;
@@ -127,34 +126,34 @@ void CJS_Runtime::DefineJSObjects() {
// The call order determines the "ObjDefID" assigned to each class.
// ObjDefIDs 0 - 2
- CJS_Border::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Display::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Font::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Border::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Display::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Font::DefineJSObjects(GetIsolate(), FXJS_STATIC);
// ObjDefIDs 3 - 5
- CJS_Highlight::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Position::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_ScaleHow::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Highlight::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Position::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_ScaleHow::DefineJSObjects(GetIsolate(), FXJS_STATIC);
// ObjDefIDs 6 - 8
- CJS_ScaleWhen::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Style::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Zoomtype::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_ScaleWhen::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Style::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Zoomtype::DefineJSObjects(GetIsolate(), FXJS_STATIC);
// ObjDefIDs 9 - 11
- CJS_App::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Color::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Console::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_App::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Color::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Console::DefineJSObjects(GetIsolate(), FXJS_STATIC);
// ObjDefIDs 12 - 14
- CJS_Document::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
- CJS_Event::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Field::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
+ CJS_Document::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
+ CJS_Event::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Field::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
// ObjDefIDs 15 - 17
- CJS_Global::DefineJSObjects(GetIsolate(), JS_STATIC);
- CJS_Icon::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
- CJS_Util::DefineJSObjects(GetIsolate(), JS_STATIC);
+ CJS_Global::DefineJSObjects(GetIsolate(), FXJS_STATIC);
+ CJS_Icon::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
+ CJS_Util::DefineJSObjects(GetIsolate(), FXJS_STATIC);
// ObjDefIDs 18 - 20 (these can't fail, return void).
CJS_PublicMethods::DefineJSObjects(GetIsolate());
@@ -162,8 +161,8 @@ void CJS_Runtime::DefineJSObjects() {
CJS_GlobalArrays::DefineJSObjects(GetIsolate());
// ObjDefIDs 21 - 22.
- CJS_TimerObj::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
- CJS_PrintParamsObj::DefineJSObjects(GetIsolate(), JS_DYNAMIC);
+ CJS_TimerObj::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
+ CJS_PrintParamsObj::DefineJSObjects(GetIsolate(), FXJS_DYNAMIC);
}
IFXJS_Context* CJS_Runtime::NewContext() {
@@ -201,11 +200,12 @@ void CJS_Runtime::SetReaderDocument(CPDFSDK_Document* pReaderDoc) {
m_pDocument = pReaderDoc;
if (pReaderDoc) {
- v8::Local<v8::Object> pThis = JS_GetThisObj(GetIsolate());
+ v8::Local<v8::Object> pThis = FXJS_GetThisObj(GetIsolate());
if (!pThis.IsEmpty()) {
- if (JS_GetObjDefnID(pThis) ==
- JS_GetObjDefnID(GetIsolate(), L"Document")) {
- if (CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pThis)) {
+ if (FXJS_GetObjDefnID(pThis) ==
+ FXJS_GetObjDefnID(GetIsolate(), L"Document")) {
+ if (CJS_Document* pJSDocument =
+ (CJS_Document*)FXJS_GetPrivate(pThis)) {
if (Document* pDocument = (Document*)pJSDocument->GetEmbedObject())
pDocument->AttachDoc(pReaderDoc);
}