summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_EventHandler.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-09-17 15:40:06 -0700
committerTom Sepez <tsepez@chromium.org>2015-09-17 15:40:06 -0700
commitd5a0e95db021e50064cc2e761f023b75c24b72a2 (patch)
treeb355b190bdec2a9e8cc56d8f4b2be888a891fc6f /fpdfsdk/src/javascript/JS_EventHandler.cpp
parent39bfe122b4867601051c56562a5ab9cf6be644ad (diff)
downloadpdfium-d5a0e95db021e50064cc2e761f023b75c24b72a2.tar.xz
Merge to XFA: Don't pass null isolates to FXJS_ when we have a real isolate.
(cherry picked from commit 34b39e1d4fa0b16d47770b823230344356cc451a) Original Review URL: https://codereview.chromium.org/1350703003 . TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1342403005 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_EventHandler.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_EventHandler.cpp44
1 files changed, 13 insertions, 31 deletions
diff --git a/fpdfsdk/src/javascript/JS_EventHandler.cpp b/fpdfsdk/src/javascript/JS_EventHandler.cpp
index bd762b4946..553fc95631 100644
--- a/fpdfsdk/src/javascript/JS_EventHandler.cpp
+++ b/fpdfsdk/src/javascript/JS_EventHandler.cpp
@@ -611,10 +611,7 @@ FX_BOOL CJS_EventHandler::Shift() {
}
Field* CJS_EventHandler::Source() {
- ASSERT(m_pJSContext != NULL);
-
CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime();
-
v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj(
pRuntime->GetIsolate(), m_pJSContext,
FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Document"));
@@ -624,32 +621,21 @@ Field* CJS_EventHandler::Source() {
FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field"));
ASSERT(pFieldObj.IsEmpty() == FALSE);
- CJS_Document* pJSDocument = (CJS_Document*)FXJS_GetPrivate(pDocObj);
+ CJS_Document* pJSDocument =
+ (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj);
Document* pDocument = (Document*)pJSDocument->GetEmbedObject();
- if (m_pTargetDoc != NULL)
- pDocument->AttachDoc(m_pTargetDoc);
- else
- pDocument->AttachDoc(m_pJSContext->GetReaderDocument());
-
- // if (m_pSourceField == NULL)
- // return NULL;
- // CRAO_Widget *pWidget = IBCL_Widget::GetWidget(m_pSourceField);
- // CPDF_FormField* pFormField = pWidget->GetFormField();
- // ASSERT(pFormField);
- // CFX_WideString csFieldName = pFormField->GetFullName();
- CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(pFieldObj);
- ASSERT(pJSField != NULL);
+ pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc
+ : m_pJSContext->GetReaderDocument());
+
+ CJS_Field* pJSField =
+ (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj);
Field* pField = (Field*)pJSField->GetEmbedObject();
- ASSERT(pField != NULL);
pField->AttachField(pDocument, m_strSourceName);
return pField;
}
Field* CJS_EventHandler::Target_Field() {
- ASSERT(m_pJSContext != NULL);
-
CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime();
-
v8::Local<v8::Object> pDocObj = FXJS_NewFxDynamicObj(
pRuntime->GetIsolate(), m_pJSContext,
FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Document"));
@@ -659,19 +645,15 @@ Field* CJS_EventHandler::Target_Field() {
FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field"));
ASSERT(pFieldObj.IsEmpty() == FALSE);
- CJS_Document* pJSDocument = (CJS_Document*)FXJS_GetPrivate(pDocObj);
+ CJS_Document* pJSDocument =
+ (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pDocObj);
Document* pDocument = (Document*)pJSDocument->GetEmbedObject();
- if (m_pTargetDoc != NULL)
- pDocument->AttachDoc(m_pTargetDoc);
- else
- pDocument->AttachDoc(m_pJSContext->GetReaderDocument());
-
- CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(pFieldObj);
- ASSERT(pJSField != NULL);
+ pDocument->AttachDoc(m_pTargetDoc ? m_pTargetDoc
+ : m_pJSContext->GetReaderDocument());
+ CJS_Field* pJSField =
+ (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pFieldObj);
Field* pField = (Field*)pJSField->GetEmbedObject();
- ASSERT(pField != NULL);
-
pField->AttachField(pDocument, m_strTargetName);
return pField;
}