summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/javascript/Document.cpp84
-rw-r--r--fpdfsdk/javascript/Field.cpp52
-rw-r--r--fpdfsdk/javascript/JS_Define.h2
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp44
-rw-r--r--fpdfsdk/javascript/app.cpp42
-rw-r--r--fpdfsdk/javascript/color.cpp4
-rw-r--r--fpdfsdk/javascript/console.cpp8
-rw-r--r--fpdfsdk/javascript/global.cpp2
-rw-r--r--fpdfsdk/javascript/report.cpp4
-rw-r--r--fpdfsdk/javascript/util.cpp6
-rw-r--r--fxjs/fxjs_v8.cpp10
-rw-r--r--fxjs/fxjs_v8.h4
12 files changed, 130 insertions, 132 deletions
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index adc831d90b..d4dc9c35bd 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -98,48 +98,48 @@ JSPropertySpec CJS_Document::PropertySpecs[] = {
{0, 0, 0}};
JSMethodSpec CJS_Document::MethodSpecs[] = {
- {L"addAnnot", addAnnot_static},
- {L"addField", addField_static},
- {L"addLink", addLink_static},
- {L"addIcon", addIcon_static},
- {L"calculateNow", calculateNow_static},
- {L"closeDoc", closeDoc_static},
- {L"createDataObject", createDataObject_static},
- {L"deletePages", deletePages_static},
- {L"exportAsText", exportAsText_static},
- {L"exportAsFDF", exportAsFDF_static},
- {L"exportAsXFDF", exportAsXFDF_static},
- {L"extractPages", extractPages_static},
- {L"getAnnot", getAnnot_static},
- {L"getAnnots", getAnnots_static},
- {L"getAnnot3D", getAnnot3D_static},
- {L"getAnnots3D", getAnnots3D_static},
- {L"getField", getField_static},
- {L"getIcon", getIcon_static},
- {L"getLinks", getLinks_static},
- {L"getNthFieldName", getNthFieldName_static},
- {L"getOCGs", getOCGs_static},
- {L"getPageBox", getPageBox_static},
- {L"getPageNthWord", getPageNthWord_static},
- {L"getPageNthWordQuads", getPageNthWordQuads_static},
- {L"getPageNumWords", getPageNumWords_static},
- {L"getPrintParams", getPrintParams_static},
- {L"getURL", getURL_static},
- {L"gotoNamedDest", gotoNamedDest_static},
- {L"importAnFDF", importAnFDF_static},
- {L"importAnXFDF", importAnXFDF_static},
- {L"importTextData", importTextData_static},
- {L"insertPages", insertPages_static},
- {L"mailForm", mailForm_static},
- {L"print", print_static},
- {L"removeField", removeField_static},
- {L"replacePages", replacePages_static},
- {L"resetForm", resetForm_static},
- {L"removeIcon", removeIcon_static},
- {L"saveAs", saveAs_static},
- {L"submitForm", submitForm_static},
- {L"syncAnnotScan", syncAnnotScan_static},
- {L"mailDoc", mailDoc_static},
+ {"addAnnot", addAnnot_static},
+ {"addField", addField_static},
+ {"addLink", addLink_static},
+ {"addIcon", addIcon_static},
+ {"calculateNow", calculateNow_static},
+ {"closeDoc", closeDoc_static},
+ {"createDataObject", createDataObject_static},
+ {"deletePages", deletePages_static},
+ {"exportAsText", exportAsText_static},
+ {"exportAsFDF", exportAsFDF_static},
+ {"exportAsXFDF", exportAsXFDF_static},
+ {"extractPages", extractPages_static},
+ {"getAnnot", getAnnot_static},
+ {"getAnnots", getAnnots_static},
+ {"getAnnot3D", getAnnot3D_static},
+ {"getAnnots3D", getAnnots3D_static},
+ {"getField", getField_static},
+ {"getIcon", getIcon_static},
+ {"getLinks", getLinks_static},
+ {"getNthFieldName", getNthFieldName_static},
+ {"getOCGs", getOCGs_static},
+ {"getPageBox", getPageBox_static},
+ {"getPageNthWord", getPageNthWord_static},
+ {"getPageNthWordQuads", getPageNthWordQuads_static},
+ {"getPageNumWords", getPageNumWords_static},
+ {"getPrintParams", getPrintParams_static},
+ {"getURL", getURL_static},
+ {"gotoNamedDest", gotoNamedDest_static},
+ {"importAnFDF", importAnFDF_static},
+ {"importAnXFDF", importAnXFDF_static},
+ {"importTextData", importTextData_static},
+ {"insertPages", insertPages_static},
+ {"mailForm", mailForm_static},
+ {"print", print_static},
+ {"removeField", removeField_static},
+ {"replacePages", replacePages_static},
+ {"resetForm", resetForm_static},
+ {"removeIcon", removeIcon_static},
+ {"saveAs", saveAs_static},
+ {"submitForm", submitForm_static},
+ {"syncAnnotScan", syncAnnotScan_static},
+ {"mailDoc", mailDoc_static},
{0, 0}};
IMPLEMENT_JS_CLASS(CJS_Document, Document)
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index c580a215c5..99e75441d4 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -136,32 +136,32 @@ JSPropertySpec CJS_Field::PropertySpecs[] = {
{0, 0, 0}};
JSMethodSpec CJS_Field::MethodSpecs[] = {
- {L"browseForFileToSubmit", browseForFileToSubmit_static},
- {L"buttonGetCaption", buttonGetCaption_static},
- {L"buttonGetIcon", buttonGetIcon_static},
- {L"buttonImportIcon", buttonImportIcon_static},
- {L"buttonSetCaption", buttonSetCaption_static},
- {L"buttonSetIcon", buttonSetIcon_static},
- {L"checkThisBox", checkThisBox_static},
- {L"clearItems", clearItems_static},
- {L"defaultIsChecked", defaultIsChecked_static},
- {L"deleteItemAt", deleteItemAt_static},
- {L"getArray", getArray_static},
- {L"getItemAt", getItemAt_static},
- {L"getLock", getLock_static},
- {L"insertItemAt", insertItemAt_static},
- {L"isBoxChecked", isBoxChecked_static},
- {L"isDefaultChecked", isDefaultChecked_static},
- {L"setAction", setAction_static},
- {L"setFocus", setFocus_static},
- {L"setItems", setItems_static},
- {L"setLock", setLock_static},
- {L"signatureGetModifications", signatureGetModifications_static},
- {L"signatureGetSeedValue", signatureGetSeedValue_static},
- {L"signatureInfo", signatureInfo_static},
- {L"signatureSetSeedValue", signatureSetSeedValue_static},
- {L"signatureSign", signatureSign_static},
- {L"signatureValidate", signatureValidate_static},
+ {"browseForFileToSubmit", browseForFileToSubmit_static},
+ {"buttonGetCaption", buttonGetCaption_static},
+ {"buttonGetIcon", buttonGetIcon_static},
+ {"buttonImportIcon", buttonImportIcon_static},
+ {"buttonSetCaption", buttonSetCaption_static},
+ {"buttonSetIcon", buttonSetIcon_static},
+ {"checkThisBox", checkThisBox_static},
+ {"clearItems", clearItems_static},
+ {"defaultIsChecked", defaultIsChecked_static},
+ {"deleteItemAt", deleteItemAt_static},
+ {"getArray", getArray_static},
+ {"getItemAt", getItemAt_static},
+ {"getLock", getLock_static},
+ {"insertItemAt", insertItemAt_static},
+ {"isBoxChecked", isBoxChecked_static},
+ {"isDefaultChecked", isDefaultChecked_static},
+ {"setAction", setAction_static},
+ {"setFocus", setFocus_static},
+ {"setItems", setItems_static},
+ {"setLock", setLock_static},
+ {"signatureGetModifications", signatureGetModifications_static},
+ {"signatureGetSeedValue", signatureGetSeedValue_static},
+ {"signatureInfo", signatureInfo_static},
+ {"signatureSetSeedValue", signatureSetSeedValue_static},
+ {"signatureSign", signatureSign_static},
+ {"signatureValidate", signatureValidate_static},
{0, 0}};
IMPLEMENT_JS_CLASS(CJS_Field, Field)
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index 4f5cc5d66e..7549dc85e3 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -30,7 +30,7 @@ struct JSPropertySpec {
};
struct JSMethodSpec {
- const wchar_t* pName;
+ const char* pName;
v8::FunctionCallback pMethodCall;
};
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 42903c25a3..3bcbc341ac 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -31,28 +31,28 @@
#define DOUBLE_CORRECT 0.000000000000001
JSMethodSpec CJS_PublicMethods::GlobalFunctionSpecs[] = {
- {L"AFNumber_Format", AFNumber_Format_static},
- {L"AFNumber_Keystroke", AFNumber_Keystroke_static},
- {L"AFPercent_Format", AFPercent_Format_static},
- {L"AFPercent_Keystroke", AFPercent_Keystroke_static},
- {L"AFDate_FormatEx", AFDate_FormatEx_static},
- {L"AFDate_KeystrokeEx", AFDate_KeystrokeEx_static},
- {L"AFDate_Format", AFDate_Format_static},
- {L"AFDate_Keystroke", AFDate_Keystroke_static},
- {L"AFTime_FormatEx", AFTime_FormatEx_static},
- {L"AFTime_KeystrokeEx", AFTime_KeystrokeEx_static},
- {L"AFTime_Format", AFTime_Format_static},
- {L"AFTime_Keystroke", AFTime_Keystroke_static},
- {L"AFSpecial_Format", AFSpecial_Format_static},
- {L"AFSpecial_Keystroke", AFSpecial_Keystroke_static},
- {L"AFSpecial_KeystrokeEx", AFSpecial_KeystrokeEx_static},
- {L"AFSimple", AFSimple_static},
- {L"AFMakeNumber", AFMakeNumber_static},
- {L"AFSimple_Calculate", AFSimple_Calculate_static},
- {L"AFRange_Validate", AFRange_Validate_static},
- {L"AFMergeChange", AFMergeChange_static},
- {L"AFParseDateEx", AFParseDateEx_static},
- {L"AFExtractNums", AFExtractNums_static},
+ {"AFNumber_Format", AFNumber_Format_static},
+ {"AFNumber_Keystroke", AFNumber_Keystroke_static},
+ {"AFPercent_Format", AFPercent_Format_static},
+ {"AFPercent_Keystroke", AFPercent_Keystroke_static},
+ {"AFDate_FormatEx", AFDate_FormatEx_static},
+ {"AFDate_KeystrokeEx", AFDate_KeystrokeEx_static},
+ {"AFDate_Format", AFDate_Format_static},
+ {"AFDate_Keystroke", AFDate_Keystroke_static},
+ {"AFTime_FormatEx", AFTime_FormatEx_static},
+ {"AFTime_KeystrokeEx", AFTime_KeystrokeEx_static},
+ {"AFTime_Format", AFTime_Format_static},
+ {"AFTime_Keystroke", AFTime_Keystroke_static},
+ {"AFSpecial_Format", AFSpecial_Format_static},
+ {"AFSpecial_Keystroke", AFSpecial_Keystroke_static},
+ {"AFSpecial_KeystrokeEx", AFSpecial_KeystrokeEx_static},
+ {"AFSimple", AFSimple_static},
+ {"AFMakeNumber", AFMakeNumber_static},
+ {"AFSimple_Calculate", AFSimple_Calculate_static},
+ {"AFRange_Validate", AFRange_Validate_static},
+ {"AFMergeChange", AFMergeChange_static},
+ {"AFParseDateEx", AFParseDateEx_static},
+ {"AFExtractNums", AFExtractNums_static},
{0, 0}};
IMPLEMENT_JS_STATIC_GLOBAL_FUN(CJS_PublicMethods)
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index d2bb7bd020..f1a39460a2 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -177,27 +177,27 @@ JSPropertySpec CJS_App::PropertySpecs[] = {
{L"viewerVersion", get_viewerVersion_static, set_viewerVersion_static},
{0, 0, 0}};
-JSMethodSpec CJS_App::MethodSpecs[] = {{L"alert", alert_static},
- {L"beep", beep_static},
- {L"browseForDoc", browseForDoc_static},
- {L"clearInterval", clearInterval_static},
- {L"clearTimeOut", clearTimeOut_static},
- {L"execDialog", execDialog_static},
- {L"execMenuItem", execMenuItem_static},
- {L"findComponent", findComponent_static},
- {L"goBack", goBack_static},
- {L"goForward", goForward_static},
- {L"launchURL", launchURL_static},
- {L"mailMsg", mailMsg_static},
- {L"newFDF", newFDF_static},
- {L"newDoc", newDoc_static},
- {L"openDoc", openDoc_static},
- {L"openFDF", openFDF_static},
- {L"popUpMenuEx", popUpMenuEx_static},
- {L"popUpMenu", popUpMenu_static},
- {L"response", response_static},
- {L"setInterval", setInterval_static},
- {L"setTimeOut", setTimeOut_static},
+JSMethodSpec CJS_App::MethodSpecs[] = {{"alert", alert_static},
+ {"beep", beep_static},
+ {"browseForDoc", browseForDoc_static},
+ {"clearInterval", clearInterval_static},
+ {"clearTimeOut", clearTimeOut_static},
+ {"execDialog", execDialog_static},
+ {"execMenuItem", execMenuItem_static},
+ {"findComponent", findComponent_static},
+ {"goBack", goBack_static},
+ {"goForward", goForward_static},
+ {"launchURL", launchURL_static},
+ {"mailMsg", mailMsg_static},
+ {"newFDF", newFDF_static},
+ {"newDoc", newDoc_static},
+ {"openDoc", openDoc_static},
+ {"openFDF", openFDF_static},
+ {"popUpMenuEx", popUpMenuEx_static},
+ {"popUpMenu", popUpMenu_static},
+ {"response", response_static},
+ {"setInterval", setInterval_static},
+ {"setTimeOut", setTimeOut_static},
{0, 0}};
IMPLEMENT_JS_CLASS(CJS_App, app)
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index 66ff90c406..abf4049b6c 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -32,8 +32,8 @@ JSPropertySpec CJS_Color::PropertySpecs[] = {
{L"yellow", get_yellow_static, set_yellow_static},
{0, 0, 0}};
-JSMethodSpec CJS_Color::MethodSpecs[] = {{L"convert", convert_static},
- {L"equal", equal_static},
+JSMethodSpec CJS_Color::MethodSpecs[] = {{"convert", convert_static},
+ {"equal", equal_static},
{0, 0}};
IMPLEMENT_JS_CLASS(CJS_Color, color)
diff --git a/fpdfsdk/javascript/console.cpp b/fpdfsdk/javascript/console.cpp
index 1b0d81d824..e9d130820f 100644
--- a/fpdfsdk/javascript/console.cpp
+++ b/fpdfsdk/javascript/console.cpp
@@ -18,10 +18,10 @@ JSConstSpec CJS_Console::ConstSpecs[] = {{0, JSConstSpec::Number, 0, 0}};
JSPropertySpec CJS_Console::PropertySpecs[] = {{0, 0, 0}};
-JSMethodSpec CJS_Console::MethodSpecs[] = {{L"clear", clear_static},
- {L"hide", hide_static},
- {L"println", println_static},
- {L"show", show_static},
+JSMethodSpec CJS_Console::MethodSpecs[] = {{"clear", clear_static},
+ {"hide", hide_static},
+ {"println", println_static},
+ {"show", show_static},
{0, 0}};
IMPLEMENT_JS_CLASS(CJS_Console, console)
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index df379c973e..eb7afb1332 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -22,7 +22,7 @@ JSConstSpec CJS_Global::ConstSpecs[] = {{0, JSConstSpec::Number, 0, 0}};
JSPropertySpec CJS_Global::PropertySpecs[] = {{0, 0, 0}};
JSMethodSpec CJS_Global::MethodSpecs[] = {
- {L"setPersistent", setPersistent_static},
+ {"setPersistent", setPersistent_static},
{0, 0}};
IMPLEMENT_SPECIAL_JS_CLASS(CJS_Global, JSGlobalAlternate, global);
diff --git a/fpdfsdk/javascript/report.cpp b/fpdfsdk/javascript/report.cpp
index 6c98f12ea1..c9c986d195 100644
--- a/fpdfsdk/javascript/report.cpp
+++ b/fpdfsdk/javascript/report.cpp
@@ -16,8 +16,8 @@ JSConstSpec CJS_Report::ConstSpecs[] = {{0, JSConstSpec::Number, 0, 0}};
JSPropertySpec CJS_Report::PropertySpecs[] = {{0, 0, 0}};
-JSMethodSpec CJS_Report::MethodSpecs[] = {{L"save", save_static},
- {L"writeText", writeText_static},
+JSMethodSpec CJS_Report::MethodSpecs[] = {{"save", save_static},
+ {"writeText", writeText_static},
{0, 0}};
IMPLEMENT_JS_CLASS(CJS_Report, Report)
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index b5423e38c0..3221cfb0cb 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -31,9 +31,9 @@ JSConstSpec CJS_Util::ConstSpecs[] = {{0, JSConstSpec::Number, 0, 0}};
JSPropertySpec CJS_Util::PropertySpecs[] = {{0, 0, 0}};
JSMethodSpec CJS_Util::MethodSpecs[] = {
- {L"printd", printd_static}, {L"printf", printf_static},
- {L"printx", printx_static}, {L"scand", scand_static},
- {L"byteToChar", byteToChar_static}, {0, 0}};
+ {"printd", printd_static}, {"printf", printf_static},
+ {"printx", printx_static}, {"scand", scand_static},
+ {"byteToChar", byteToChar_static}, {0, 0}};
IMPLEMENT_JS_CLASS(CJS_Util, util)
diff --git a/fxjs/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp
index a5eba1bbc1..dc2071a88f 100644
--- a/fxjs/fxjs_v8.cpp
+++ b/fxjs/fxjs_v8.cpp
@@ -270,18 +270,17 @@ int CFXJS_Engine::DefineObj(const char* sObjName,
}
void CFXJS_Engine::DefineObjMethod(int nObjDefnID,
- const wchar_t* sMethodName,
+ const char* sMethodName,
v8::FunctionCallback pMethodCall) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsMethodName = FX_UTF8Encode(CFX_WideStringC(sMethodName));
CFXJS_ObjDefinition* pObjDef =
CFXJS_ObjDefinition::ForID(m_isolate, nObjDefnID);
v8::Local<v8::FunctionTemplate> fun = v8::FunctionTemplate::New(
m_isolate, pMethodCall, v8::Local<v8::Value>(), pObjDef->GetSignature());
fun->RemovePrototype();
pObjDef->GetInstanceTemplate()->Set(
- v8::String::NewFromUtf8(m_isolate, bsMethodName.c_str(),
+ v8::String::NewFromUtf8(m_isolate, sMethodName,
v8::NewStringType::kNormal)
.ToLocalChecked(),
fun, v8::ReadOnly);
@@ -328,16 +327,15 @@ void CFXJS_Engine::DefineObjConst(int nObjDefnID,
pObjDef->GetInstanceTemplate()->Set(m_isolate, bsConstName.c_str(), pDefault);
}
-void CFXJS_Engine::DefineGlobalMethod(const wchar_t* sMethodName,
+void CFXJS_Engine::DefineGlobalMethod(const char* sMethodName,
v8::FunctionCallback pMethodCall) {
v8::Isolate::Scope isolate_scope(m_isolate);
v8::HandleScope handle_scope(m_isolate);
- CFX_ByteString bsMethodName = FX_UTF8Encode(CFX_WideStringC(sMethodName));
v8::Local<v8::FunctionTemplate> fun =
v8::FunctionTemplate::New(m_isolate, pMethodCall);
fun->RemovePrototype();
GetGlobalObjectTemplate(m_isolate)->Set(
- v8::String::NewFromUtf8(m_isolate, bsMethodName.c_str(),
+ v8::String::NewFromUtf8(m_isolate, sMethodName,
v8::NewStringType::kNormal)
.ToLocalChecked(),
fun, v8::ReadOnly);
diff --git a/fxjs/fxjs_v8.h b/fxjs/fxjs_v8.h
index 541566f6d0..6b988e71a2 100644
--- a/fxjs/fxjs_v8.h
+++ b/fxjs/fxjs_v8.h
@@ -148,7 +148,7 @@ class CFXJS_Engine {
Destructor pDestructor);
void DefineObjMethod(int nObjDefnID,
- const wchar_t* sMethodName,
+ const char* sMethodName,
v8::FunctionCallback pMethodCall);
void DefineObjProperty(int nObjDefnID,
const wchar_t* sPropName,
@@ -162,7 +162,7 @@ class CFXJS_Engine {
void DefineObjConst(int nObjDefnID,
const wchar_t* sConstName,
v8::Local<v8::Value> pDefault);
- void DefineGlobalMethod(const wchar_t* sMethodName,
+ void DefineGlobalMethod(const char* sMethodName,
v8::FunctionCallback pMethodCall);
void DefineGlobalConst(const wchar_t* sConstName,
v8::FunctionCallback pConstGetter);