diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-09-17 15:30:14 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-09-17 15:30:14 -0700 |
commit | 34b39e1d4fa0b16d47770b823230344356cc451a (patch) | |
tree | b4e379ba6ff9a4b03d753156345cc596d15e1547 /fpdfsdk/src/javascript/JS_EventHandler.cpp | |
parent | fa31d9630aadfe101d3b35e26ce0fc926ec1505b (diff) | |
download | pdfium-34b39e1d4fa0b16d47770b823230344356cc451a.tar.xz |
Don't pass null isolates to FXJS_ when we have a real isolate.
Kill some now unused functions as a result.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1350703003 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_EventHandler.cpp')
-rw-r--r-- | fpdfsdk/src/javascript/JS_EventHandler.cpp | 44 |
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; } |