Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: fpdfsdk/src/javascript/Field.cpp

Issue 1350703003: Don't pass null isolates to FXJS_ when we have a real isolate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/JS_EventHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/Field.cpp
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 66a9601cbf27dca62e31a706c8e11c5d2848b494..140bb422feb52a460fb0a29b987815a4535878f7 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));
Lei Zhang 2015/09/17 00:10:23 I didn't see the delete / RemoveAll() at first and
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;
« no previous file with comments | « fpdfsdk/src/javascript/Document.cpp ('k') | fpdfsdk/src/javascript/JS_EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698