diff options
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r-- | fpdfsdk/src/javascript/Document.cpp | 198 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/Field.cpp | 52 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/PublicMethods.cpp | 44 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/app.cpp | 42 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/color.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/console.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/global.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/report.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/resource.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/util.cpp | 10 |
10 files changed, 191 insertions, 177 deletions
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 2bf4f5e810..e6bcf82bfc 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -98,46 +98,46 @@ BEGIN_JS_STATIC_PROP(CJS_Document) END_JS_STATIC_PROP() BEGIN_JS_STATIC_METHOD(CJS_Document) - JS_STATIC_METHOD_ENTRY(addAnnot,0) - JS_STATIC_METHOD_ENTRY(addField, 4) - JS_STATIC_METHOD_ENTRY(addLink, 0) - JS_STATIC_METHOD_ENTRY(addIcon, 0) - JS_STATIC_METHOD_ENTRY(calculateNow, 0) - JS_STATIC_METHOD_ENTRY(closeDoc, 0) - JS_STATIC_METHOD_ENTRY(createDataObject, 0) - JS_STATIC_METHOD_ENTRY(deletePages, 2) - JS_STATIC_METHOD_ENTRY(exportAsText, 3) - JS_STATIC_METHOD_ENTRY(exportAsFDF, 6) - JS_STATIC_METHOD_ENTRY(exportAsXFDF, 5) - JS_STATIC_METHOD_ENTRY(extractPages, 3) - JS_STATIC_METHOD_ENTRY(getAnnot, 0) - JS_STATIC_METHOD_ENTRY(getAnnots, 2) - JS_STATIC_METHOD_ENTRY(getAnnot3D, 2) - JS_STATIC_METHOD_ENTRY(getAnnots3D, 1) - JS_STATIC_METHOD_ENTRY(getField, 1) - JS_STATIC_METHOD_ENTRY(getIcon, 0) - JS_STATIC_METHOD_ENTRY(getLinks, 0) - JS_STATIC_METHOD_ENTRY(getNthFieldName, 1) - JS_STATIC_METHOD_ENTRY(getOCGs, 0) - JS_STATIC_METHOD_ENTRY(getPageBox, 0) - JS_STATIC_METHOD_ENTRY(getPageNthWord, 3) - JS_STATIC_METHOD_ENTRY(getPageNthWordQuads, 2) - JS_STATIC_METHOD_ENTRY(getPageNumWords, 1) - JS_STATIC_METHOD_ENTRY(getPrintParams, 0) - JS_STATIC_METHOD_ENTRY(getURL, 2) - JS_STATIC_METHOD_ENTRY(importAnFDF, 1) - JS_STATIC_METHOD_ENTRY(importAnXFDF, 1) - JS_STATIC_METHOD_ENTRY(importTextData, 2) - JS_STATIC_METHOD_ENTRY(insertPages, 4) - JS_STATIC_METHOD_ENTRY(mailForm, 6) - JS_STATIC_METHOD_ENTRY(print, 9) - JS_STATIC_METHOD_ENTRY(removeField, 1) - JS_STATIC_METHOD_ENTRY(replacePages, 4) - JS_STATIC_METHOD_ENTRY(resetForm, 1) - JS_STATIC_METHOD_ENTRY(removeIcon, 0) - JS_STATIC_METHOD_ENTRY(saveAs, 5) - JS_STATIC_METHOD_ENTRY(submitForm, 23) - JS_STATIC_METHOD_ENTRY(mailDoc, 0) + JS_STATIC_METHOD_ENTRY(addAnnot) + JS_STATIC_METHOD_ENTRY(addField) + JS_STATIC_METHOD_ENTRY(addLink) + JS_STATIC_METHOD_ENTRY(addIcon) + JS_STATIC_METHOD_ENTRY(calculateNow) + JS_STATIC_METHOD_ENTRY(closeDoc) + JS_STATIC_METHOD_ENTRY(createDataObject) + JS_STATIC_METHOD_ENTRY(deletePages) + JS_STATIC_METHOD_ENTRY(exportAsText) + JS_STATIC_METHOD_ENTRY(exportAsFDF) + JS_STATIC_METHOD_ENTRY(exportAsXFDF) + JS_STATIC_METHOD_ENTRY(extractPages) + JS_STATIC_METHOD_ENTRY(getAnnot) + JS_STATIC_METHOD_ENTRY(getAnnots) + JS_STATIC_METHOD_ENTRY(getAnnot3D) + JS_STATIC_METHOD_ENTRY(getAnnots3D) + JS_STATIC_METHOD_ENTRY(getField) + JS_STATIC_METHOD_ENTRY(getIcon) + JS_STATIC_METHOD_ENTRY(getLinks) + JS_STATIC_METHOD_ENTRY(getNthFieldName) + JS_STATIC_METHOD_ENTRY(getOCGs) + JS_STATIC_METHOD_ENTRY(getPageBox) + JS_STATIC_METHOD_ENTRY(getPageNthWord) + JS_STATIC_METHOD_ENTRY(getPageNthWordQuads) + JS_STATIC_METHOD_ENTRY(getPageNumWords) + JS_STATIC_METHOD_ENTRY(getPrintParams) + JS_STATIC_METHOD_ENTRY(getURL) + JS_STATIC_METHOD_ENTRY(importAnFDF) + JS_STATIC_METHOD_ENTRY(importAnXFDF) + JS_STATIC_METHOD_ENTRY(importTextData) + JS_STATIC_METHOD_ENTRY(insertPages) + JS_STATIC_METHOD_ENTRY(mailForm) + JS_STATIC_METHOD_ENTRY(print) + JS_STATIC_METHOD_ENTRY(removeField) + JS_STATIC_METHOD_ENTRY(replacePages) + JS_STATIC_METHOD_ENTRY(resetForm) + JS_STATIC_METHOD_ENTRY(removeIcon) + JS_STATIC_METHOD_ENTRY(saveAs) + JS_STATIC_METHOD_ENTRY(submitForm) + JS_STATIC_METHOD_ENTRY(mailDoc) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_Document, Document) @@ -321,58 +321,51 @@ FX_BOOL Document::exportAsXFDF(IFXJS_Context* cc, const CJS_Parameters& params, FX_BOOL Document::getField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { - v8::Isolate* isolate = GetIsolate(cc); - ASSERT(m_pDocument != NULL); - - if (params.size() < 1) return FALSE; + CJS_Context* pContext = (CJS_Context*)cc; + if (params.size() < 1) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + return FALSE; + } CFX_WideString wideName = params[0].ToCFXWideString(); CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); - ASSERT(pPDFForm != NULL); - if (pPDFForm->CountFields(wideName) <= 0) { vRet.SetNull(); return TRUE; } - CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); - - JSFXObject pFieldObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"Field")); - - CJS_Field * pJSField = (CJS_Field*)JS_GetPrivate(isolate,pFieldObj); - ASSERT(pJSField != NULL); - - Field * pField = (Field *)pJSField->GetEmbedObject(); - ASSERT(pField != NULL); + JSFXObject pFieldObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"Field")); + v8::Isolate* isolate = GetIsolate(cc); + CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(isolate,pFieldObj); + Field* pField = (Field *)pJSField->GetEmbedObject(); pField->AttachField(this, wideName); - vRet = pJSField; + vRet = pJSField; return TRUE; } //Gets the name of the nth field in the document FX_BOOL Document::getNthFieldName(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { - ASSERT(m_pDocument != NULL); + CJS_Context* pContext = (CJS_Context*)cc; + if (params.size() != 1) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + return FALSE; + } - int nIndex = params.size() > 0 ? params[0].ToInt() : -1; - if (nIndex == -1) return FALSE; + int nIndex = params[0].ToInt(); + if (nIndex < 0) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); + return FALSE; + } CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); - ASSERT(pInterForm != NULL); - CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); - ASSERT(pPDFForm != NULL); - CPDF_FormField* pField = pPDFForm->GetField(nIndex); if (!pField) return FALSE; @@ -523,11 +516,13 @@ FX_BOOL Document::removeField(IFXJS_Context* cc, const CJS_Parameters& params, C if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) return FALSE; - if (params.size() < 1) - return TRUE; + CJS_Context* pContext = (CJS_Context*)cc; + if (params.size() != 1) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + return FALSE; + } CFX_WideString sFieldName = params[0].ToCFXWideString(); - CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); ASSERT(pInterForm != NULL); @@ -641,11 +636,12 @@ FX_BOOL Document::saveAs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va FX_BOOL Document::submitForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { ASSERT(m_pDocument != NULL); - -// if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; - + CJS_Context* pContext = (CJS_Context*)cc; int nSize = params.size(); - if (nSize < 1) return FALSE; + if (nSize < 1) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + return FALSE; + } CFX_WideString strURL; FX_BOOL bFDF = TRUE; @@ -1457,22 +1453,28 @@ void IconTree::DeleteIconElement(CFX_WideString swIconName) FX_BOOL Document::addIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { - if (params.size() != 2)return FALSE; - CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); - CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); + if (params.size() != 2) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + return FALSE; + } CFX_WideString swIconName = params[0].ToCFXWideString(); - JSFXObject pJSIcon = params[1].ToV8Object(); - if (JS_GetObjDefnID(pJSIcon) != JS_GetObjDefnID(*pRuntime, L"Icon")) return FALSE; + + CJS_Runtime* pRuntime = pContext->GetJSRuntime(); + if (JS_GetObjDefnID(pJSIcon) != JS_GetObjDefnID(*pRuntime, L"Icon")) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); + return FALSE; + } CJS_EmbedObj* pEmbedObj = params[1].ToCJSObject()->GetEmbedObject(); - if (!pEmbedObj)return FALSE; - Icon* pIcon = (Icon*)pEmbedObj; + if (!pEmbedObj) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSTYPEERROR); + return FALSE; + } + Icon* pIcon = (Icon*)pEmbedObj; if (!m_pIconTree) m_pIconTree = new IconTree(); @@ -1529,13 +1531,17 @@ FX_BOOL Document::icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE FX_BOOL Document::getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { - if (params.size() != 1)return FALSE; + CJS_Context* pContext = (CJS_Context *)cc; + if (params.size() != 1) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + return FALSE; + } + if(!m_pIconTree) return FALSE; CFX_WideString swIconName = params[0].ToCFXWideString(); int iIconCounts = m_pIconTree->GetLength(); - CJS_Context* pContext = (CJS_Context *)cc; CJS_Runtime* pRuntime = pContext->GetJSRuntime(); for (int i = 0; i < iIconCounts; i++) @@ -1565,7 +1571,12 @@ FX_BOOL Document::getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V FX_BOOL Document::removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { - if (params.size() != 1)return FALSE; + CJS_Context* pContext = (CJS_Context *)cc; + if (params.size() != 1) { + sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + return FALSE; + } + if(!m_pIconTree) return FALSE; CFX_WideString swIconName = params[0].ToCFXWideString(); @@ -1615,10 +1626,10 @@ FX_BOOL Document::getPageNthWord(IFXJS_Context* cc, const CJS_Parameters& params CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); if (!pDocument) return FALSE; + CJS_Context* pContext = static_cast<CJS_Context*>(cc); if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) { - CJS_Context* pContext = static_cast<CJS_Context*>(cc); - sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); return FALSE; } @@ -1685,10 +1696,10 @@ FX_BOOL Document::getPageNumWords(IFXJS_Context* cc, const CJS_Parameters& param CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); ASSERT(pDocument != NULL); + CJS_Context* pContext = static_cast<CJS_Context*>(cc); if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) { - CJS_Context* pContext = static_cast<CJS_Context*>(cc); - sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); + sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); return FALSE; } @@ -1724,13 +1735,12 @@ FX_BOOL Document::getPageNumWords(IFXJS_Context* cc, const CJS_Parameters& param FX_BOOL Document::getPrintParams(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError) { CJS_Context* pContext = (CJS_Context*)cc; - ASSERT(pContext != NULL); CJS_Runtime* pRuntime = pContext->GetJSRuntime(); - ASSERT(pRuntime != NULL); JSFXObject pRetObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnID(*pRuntime, L"PrintParamsObj")); - //not implemented yet. - vRet = pRetObj; + // Not implemented yet. + + vRet = pRetObj; return TRUE; } diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp index 8f20ec8bc8..c8edcf64a4 100644 --- a/fpdfsdk/src/javascript/Field.cpp +++ b/fpdfsdk/src/javascript/Field.cpp @@ -81,32 +81,32 @@ BEGIN_JS_STATIC_PROP(CJS_Field) END_JS_STATIC_PROP() BEGIN_JS_STATIC_METHOD(CJS_Field) - JS_STATIC_METHOD_ENTRY(browseForFileToSubmit, 0) - JS_STATIC_METHOD_ENTRY(buttonGetCaption, 1) - JS_STATIC_METHOD_ENTRY(buttonGetIcon, 1) - JS_STATIC_METHOD_ENTRY(buttonImportIcon, 0) - JS_STATIC_METHOD_ENTRY(buttonSetCaption, 2) - JS_STATIC_METHOD_ENTRY(buttonSetIcon, 2) - JS_STATIC_METHOD_ENTRY(checkThisBox, 2) - JS_STATIC_METHOD_ENTRY(clearItems, 0) - JS_STATIC_METHOD_ENTRY(defaultIsChecked, 2) - JS_STATIC_METHOD_ENTRY(deleteItemAt, 1) - JS_STATIC_METHOD_ENTRY(getArray , 0) - JS_STATIC_METHOD_ENTRY(getItemAt, 0) - JS_STATIC_METHOD_ENTRY(getLock, 0) - JS_STATIC_METHOD_ENTRY(insertItemAt, 0) - JS_STATIC_METHOD_ENTRY(isBoxChecked, 1) - JS_STATIC_METHOD_ENTRY(isDefaultChecked, 1) - JS_STATIC_METHOD_ENTRY(setAction, 2) - JS_STATIC_METHOD_ENTRY(setFocus, 0) - JS_STATIC_METHOD_ENTRY(setItems, 1) - JS_STATIC_METHOD_ENTRY(setLock, 0) - JS_STATIC_METHOD_ENTRY(signatureGetModifications, 0) - JS_STATIC_METHOD_ENTRY(signatureGetSeedValue, 0) - JS_STATIC_METHOD_ENTRY(signatureInfo, 0) - JS_STATIC_METHOD_ENTRY(signatureSetSeedValue, 0) - JS_STATIC_METHOD_ENTRY(signatureSign, 0) - JS_STATIC_METHOD_ENTRY(signatureValidate, 0) + JS_STATIC_METHOD_ENTRY(browseForFileToSubmit) + JS_STATIC_METHOD_ENTRY(buttonGetCaption) + JS_STATIC_METHOD_ENTRY(buttonGetIcon) + JS_STATIC_METHOD_ENTRY(buttonImportIcon) + JS_STATIC_METHOD_ENTRY(buttonSetCaption) + JS_STATIC_METHOD_ENTRY(buttonSetIcon) + JS_STATIC_METHOD_ENTRY(checkThisBox) + JS_STATIC_METHOD_ENTRY(clearItems) + JS_STATIC_METHOD_ENTRY(defaultIsChecked) + JS_STATIC_METHOD_ENTRY(deleteItemAt) + JS_STATIC_METHOD_ENTRY(getArray ) + JS_STATIC_METHOD_ENTRY(getItemAt) + JS_STATIC_METHOD_ENTRY(getLock) + JS_STATIC_METHOD_ENTRY(insertItemAt) + JS_STATIC_METHOD_ENTRY(isBoxChecked) + JS_STATIC_METHOD_ENTRY(isDefaultChecked) + JS_STATIC_METHOD_ENTRY(setAction) + JS_STATIC_METHOD_ENTRY(setFocus) + JS_STATIC_METHOD_ENTRY(setItems) + JS_STATIC_METHOD_ENTRY(setLock) + JS_STATIC_METHOD_ENTRY(signatureGetModifications) + JS_STATIC_METHOD_ENTRY(signatureGetSeedValue) + JS_STATIC_METHOD_ENTRY(signatureInfo) + JS_STATIC_METHOD_ENTRY(signatureSetSeedValue) + JS_STATIC_METHOD_ENTRY(signatureSign) + JS_STATIC_METHOD_ENTRY(signatureValidate) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_Field, Field) diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp index ff5b9a787a..6a9839ebf5 100644 --- a/fpdfsdk/src/javascript/PublicMethods.cpp +++ b/fpdfsdk/src/javascript/PublicMethods.cpp @@ -36,28 +36,28 @@ static v8::Isolate* GetIsolate(IFXJS_Context* cc) #define DOUBLE_CORRECT 0.000000000000001 BEGIN_JS_STATIC_GLOBAL_FUN(CJS_PublicMethods) - JS_STATIC_GLOBAL_FUN_ENTRY(AFNumber_Format,6) - JS_STATIC_GLOBAL_FUN_ENTRY(AFNumber_Keystroke,6) - JS_STATIC_GLOBAL_FUN_ENTRY(AFPercent_Format,2) - JS_STATIC_GLOBAL_FUN_ENTRY(AFPercent_Keystroke,2) - JS_STATIC_GLOBAL_FUN_ENTRY(AFDate_FormatEx,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFDate_KeystrokeEx,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFDate_Format,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFDate_Keystroke,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFTime_FormatEx,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFTime_KeystrokeEx,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFTime_Format,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFTime_Keystroke,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFSpecial_Format,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFSpecial_Keystroke,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFSpecial_KeystrokeEx,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFSimple,3) - JS_STATIC_GLOBAL_FUN_ENTRY(AFMakeNumber,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFSimple_Calculate,2) - JS_STATIC_GLOBAL_FUN_ENTRY(AFRange_Validate,4) - JS_STATIC_GLOBAL_FUN_ENTRY(AFMergeChange,1) - JS_STATIC_GLOBAL_FUN_ENTRY(AFParseDateEx,2) - JS_STATIC_GLOBAL_FUN_ENTRY(AFExtractNums,1) + JS_STATIC_GLOBAL_FUN_ENTRY(AFNumber_Format) + JS_STATIC_GLOBAL_FUN_ENTRY(AFNumber_Keystroke) + JS_STATIC_GLOBAL_FUN_ENTRY(AFPercent_Format) + JS_STATIC_GLOBAL_FUN_ENTRY(AFPercent_Keystroke) + JS_STATIC_GLOBAL_FUN_ENTRY(AFDate_FormatEx) + JS_STATIC_GLOBAL_FUN_ENTRY(AFDate_KeystrokeEx) + JS_STATIC_GLOBAL_FUN_ENTRY(AFDate_Format) + JS_STATIC_GLOBAL_FUN_ENTRY(AFDate_Keystroke) + JS_STATIC_GLOBAL_FUN_ENTRY(AFTime_FormatEx) + JS_STATIC_GLOBAL_FUN_ENTRY(AFTime_KeystrokeEx) + JS_STATIC_GLOBAL_FUN_ENTRY(AFTime_Format) + JS_STATIC_GLOBAL_FUN_ENTRY(AFTime_Keystroke) + JS_STATIC_GLOBAL_FUN_ENTRY(AFSpecial_Format) + JS_STATIC_GLOBAL_FUN_ENTRY(AFSpecial_Keystroke) + JS_STATIC_GLOBAL_FUN_ENTRY(AFSpecial_KeystrokeEx) + JS_STATIC_GLOBAL_FUN_ENTRY(AFSimple) + JS_STATIC_GLOBAL_FUN_ENTRY(AFMakeNumber) + JS_STATIC_GLOBAL_FUN_ENTRY(AFSimple_Calculate) + JS_STATIC_GLOBAL_FUN_ENTRY(AFRange_Validate) + JS_STATIC_GLOBAL_FUN_ENTRY(AFMergeChange) + JS_STATIC_GLOBAL_FUN_ENTRY(AFParseDateEx) + JS_STATIC_GLOBAL_FUN_ENTRY(AFExtractNums) END_JS_STATIC_GLOBAL_FUN() IMPLEMENT_JS_STATIC_GLOBAL_FUN(CJS_PublicMethods) diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp index 45998b0ebe..d2b26a124d 100644 --- a/fpdfsdk/src/javascript/app.cpp +++ b/fpdfsdk/src/javascript/app.cpp @@ -94,27 +94,27 @@ BEGIN_JS_STATIC_PROP(CJS_App) END_JS_STATIC_PROP() BEGIN_JS_STATIC_METHOD(CJS_App) - JS_STATIC_METHOD_ENTRY(alert, 6) - JS_STATIC_METHOD_ENTRY(beep, 1) - JS_STATIC_METHOD_ENTRY(browseForDoc, 0) - JS_STATIC_METHOD_ENTRY(clearInterval, 1) - JS_STATIC_METHOD_ENTRY(clearTimeOut, 1) - JS_STATIC_METHOD_ENTRY(execDialog, 3) - JS_STATIC_METHOD_ENTRY(execMenuItem, 1) - JS_STATIC_METHOD_ENTRY(findComponent, 1) - JS_STATIC_METHOD_ENTRY(goBack, 0) - JS_STATIC_METHOD_ENTRY(goForward, 0) - JS_STATIC_METHOD_ENTRY(launchURL, 0) - JS_STATIC_METHOD_ENTRY(mailMsg, 0) - JS_STATIC_METHOD_ENTRY(newFDF, 0) - JS_STATIC_METHOD_ENTRY(newDoc, 0) - JS_STATIC_METHOD_ENTRY(openDoc, 0) - JS_STATIC_METHOD_ENTRY(openFDF, 5) - JS_STATIC_METHOD_ENTRY(popUpMenuEx, 0) - JS_STATIC_METHOD_ENTRY(popUpMenu, 0) - JS_STATIC_METHOD_ENTRY(response, 0) - JS_STATIC_METHOD_ENTRY(setInterval, 2) - JS_STATIC_METHOD_ENTRY(setTimeOut, 2) + JS_STATIC_METHOD_ENTRY(alert) + JS_STATIC_METHOD_ENTRY(beep) + JS_STATIC_METHOD_ENTRY(browseForDoc) + JS_STATIC_METHOD_ENTRY(clearInterval) + JS_STATIC_METHOD_ENTRY(clearTimeOut) + JS_STATIC_METHOD_ENTRY(execDialog) + JS_STATIC_METHOD_ENTRY(execMenuItem) + JS_STATIC_METHOD_ENTRY(findComponent) + JS_STATIC_METHOD_ENTRY(goBack) + JS_STATIC_METHOD_ENTRY(goForward) + JS_STATIC_METHOD_ENTRY(launchURL) + JS_STATIC_METHOD_ENTRY(mailMsg) + JS_STATIC_METHOD_ENTRY(newFDF) + JS_STATIC_METHOD_ENTRY(newDoc) + JS_STATIC_METHOD_ENTRY(openDoc) + JS_STATIC_METHOD_ENTRY(openFDF) + JS_STATIC_METHOD_ENTRY(popUpMenuEx) + JS_STATIC_METHOD_ENTRY(popUpMenu) + JS_STATIC_METHOD_ENTRY(response) + JS_STATIC_METHOD_ENTRY(setInterval) + JS_STATIC_METHOD_ENTRY(setTimeOut) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_App,app) diff --git a/fpdfsdk/src/javascript/color.cpp b/fpdfsdk/src/javascript/color.cpp index ddf6ed4361..7f36be0920 100644 --- a/fpdfsdk/src/javascript/color.cpp +++ b/fpdfsdk/src/javascript/color.cpp @@ -45,8 +45,8 @@ BEGIN_JS_STATIC_PROP(CJS_Color) END_JS_STATIC_PROP() BEGIN_JS_STATIC_METHOD(CJS_Color) - JS_STATIC_METHOD_ENTRY(convert, 2) - JS_STATIC_METHOD_ENTRY(equal, 2) + JS_STATIC_METHOD_ENTRY(convert) + JS_STATIC_METHOD_ENTRY(equal) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_Color,color) diff --git a/fpdfsdk/src/javascript/console.cpp b/fpdfsdk/src/javascript/console.cpp index 9d67b4dfb6..f13017022b 100644 --- a/fpdfsdk/src/javascript/console.cpp +++ b/fpdfsdk/src/javascript/console.cpp @@ -22,10 +22,10 @@ BEGIN_JS_STATIC_PROP(CJS_Console) END_JS_STATIC_PROP() BEGIN_JS_STATIC_METHOD(CJS_Console) - JS_STATIC_METHOD_ENTRY(clear, 0) - JS_STATIC_METHOD_ENTRY(hide, 0) - JS_STATIC_METHOD_ENTRY(println, 1) - JS_STATIC_METHOD_ENTRY(show, 0) + JS_STATIC_METHOD_ENTRY(clear) + JS_STATIC_METHOD_ENTRY(hide) + JS_STATIC_METHOD_ENTRY(println) + JS_STATIC_METHOD_ENTRY(show) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_Console,console) diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp index b778239b5d..ac77f8e5e1 100644 --- a/fpdfsdk/src/javascript/global.cpp +++ b/fpdfsdk/src/javascript/global.cpp @@ -92,7 +92,7 @@ BEGIN_JS_STATIC_PROP(CJS_Global) END_JS_STATIC_PROP() BEGIN_JS_STATIC_METHOD(CJS_Global) - JS_STATIC_METHOD_ENTRY(setPersistent, 2) + JS_STATIC_METHOD_ENTRY(setPersistent) END_JS_STATIC_METHOD() IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, global_alternate, global); diff --git a/fpdfsdk/src/javascript/report.cpp b/fpdfsdk/src/javascript/report.cpp index 0f60f12ac8..1478feb1fa 100644 --- a/fpdfsdk/src/javascript/report.cpp +++ b/fpdfsdk/src/javascript/report.cpp @@ -20,8 +20,8 @@ BEGIN_JS_STATIC_PROP(CJS_Report) END_JS_STATIC_PROP() BEGIN_JS_STATIC_METHOD(CJS_Report) - JS_STATIC_METHOD_ENTRY(save, 1) - JS_STATIC_METHOD_ENTRY(writeText,1) + JS_STATIC_METHOD_ENTRY(save) + JS_STATIC_METHOD_ENTRY(writeText) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_Report, Report) diff --git a/fpdfsdk/src/javascript/resource.cpp b/fpdfsdk/src/javascript/resource.cpp index be24ccd66c..4375da3ff7 100644 --- a/fpdfsdk/src/javascript/resource.cpp +++ b/fpdfsdk/src/javascript/resource.cpp @@ -43,6 +43,10 @@ CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT id) return L"Global value not found."; case IDS_STRING_JSREADONLY: return L"Cannot assign to readonly property."; + case IDS_STRING_JSTYPEERROR: + return L"Incorrect parameter type."; + case IDS_STRING_JSVALUEERROR: + return L"Incorrect parameter value."; default: return L""; } diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp index 6898d0c1a2..f7e97acb1f 100644 --- a/fpdfsdk/src/javascript/util.cpp +++ b/fpdfsdk/src/javascript/util.cpp @@ -38,11 +38,11 @@ BEGIN_JS_STATIC_PROP(CJS_Util) END_JS_STATIC_PROP() BEGIN_JS_STATIC_METHOD(CJS_Util) - JS_STATIC_METHOD_ENTRY(printd, 3) - JS_STATIC_METHOD_ENTRY(printf, 20) - JS_STATIC_METHOD_ENTRY(printx, 2) - JS_STATIC_METHOD_ENTRY(scand, 2) - JS_STATIC_METHOD_ENTRY(byteToChar, 1) + JS_STATIC_METHOD_ENTRY(printd) + JS_STATIC_METHOD_ENTRY(printf) + JS_STATIC_METHOD_ENTRY(printx) + JS_STATIC_METHOD_ENTRY(scand) + JS_STATIC_METHOD_ENTRY(byteToChar) END_JS_STATIC_METHOD() IMPLEMENT_JS_CLASS(CJS_Util,util) |