summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/Field.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/Field.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/Field.cpp')
-rw-r--r--fpdfsdk/src/javascript/Field.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 52f6321f4a..266f29592a 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -3300,8 +3300,6 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc,
return FALSE;
CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0);
- ASSERT(pFormField != NULL);
-
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
return FALSE;
@@ -3310,17 +3308,13 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
-
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- ASSERT(pRuntime != NULL);
-
v8::Local<v8::Object> pObj =
FXJS_NewFxDynamicObj(pRuntime->GetIsolate(), pContext,
FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Icon"));
ASSERT(pObj.IsEmpty() == FALSE);
- CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pObj);
+ CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj);
Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
CPDF_Stream* pIconStream = NULL;
@@ -3339,8 +3333,6 @@ FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc,
return TRUE;
}
-//#pragma warning(default: 4800)
-
FX_BOOL Field::buttonImportIcon(IFXJS_Context* cc,
const CJS_Parameters& params,
CJS_Value& vRet,
@@ -3526,22 +3518,20 @@ FX_BOOL Field::getArray(IFXJS_Context* cc,
CJS_Array FormFieldArray(m_isolate);
for (int j = 0, jsz = swSort.GetSize(); j < jsz; j++) {
- CFX_WideString* pStr = swSort.GetAt(j);
-
+ nonstd::unique_ptr<CFX_WideString> pStr(swSort.GetAt(j));
v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(
pRuntime->GetIsolate(), pContext,
FXJS_GetObjDefnID(pRuntime->GetIsolate(), L"Field"));
ASSERT(pObj.IsEmpty() == FALSE);
- CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(pObj);
+ CJS_Field* pJSField =
+ (CJS_Field*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj);
Field* pField = (Field*)pJSField->GetEmbedObject();
pField->AttachField(m_pJSDoc, *pStr);
CJS_Value FormFieldValue(m_isolate);
FormFieldValue = pJSField;
FormFieldArray.SetElement(j, FormFieldValue);
-
- delete pStr;
}
vRet = FormFieldArray;