From 34b39e1d4fa0b16d47770b823230344356cc451a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 17 Sep 2015 15:30:14 -0700 Subject: 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 . --- fpdfsdk/src/javascript/JS_EventHandler.cpp | 44 +++++++++--------------------- 1 file changed, 13 insertions(+), 31 deletions(-) (limited to 'fpdfsdk/src/javascript/JS_EventHandler.cpp') 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 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 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; } -- cgit v1.2.3