summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-22 15:36:49 -0700
committerLei Zhang <thestig@chromium.org>2015-06-22 15:36:49 -0700
commit0de47533e05ce7ca80c48156d50a217993e97288 (patch)
tree768a23fe639072ec95ca86c10319b30ddf7abbc2
parent6ea012325fca56a37b9adbda2d3549569d242271 (diff)
downloadpdfium-chromium/2442.tar.xz
- Return true instead of false. All the other unsupported JS functions return true. - Adjust test expectations accordingly. TBR=jam@chromium.org Review URL: https://codereview.chromium.org/1196163006.
-rw-r--r--fpdfsdk/src/javascript/Document.cpp4
-rw-r--r--testing/resources/javascript/document_methods.in22
-rw-r--r--testing/resources/javascript/document_methods_expected.txt9
3 files changed, 10 insertions, 25 deletions
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 1d2dca5a3d..c35045c76b 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1541,7 +1541,7 @@ 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)
{
// Unsafe, no supported.
- return FALSE;
+ return TRUE;
}
FX_BOOL Document::createDataObject(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
@@ -1806,7 +1806,7 @@ FX_BOOL Document::zoomType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
FX_BOOL Document::deletePages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
// Unsafe, no supported.
- return FALSE;
+ return TRUE;
}
FX_BOOL Document::extractPages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
diff --git a/testing/resources/javascript/document_methods.in b/testing/resources/javascript/document_methods.in
index 662c05c8e0..b2467f37c4 100644
--- a/testing/resources/javascript/document_methods.in
+++ b/testing/resources/javascript/document_methods.in
@@ -134,14 +134,6 @@ function testCalculateNow() {
// TODO(tsepez): test success cases.
}
-function testDeletePages() {
- // Method is present.
- expect('typeof this.deletePages', 'function');
-
- // TODO(tsepez): test with no permissions.
- // TODO(tsepez): test success cases.
-}
-
function testGetField() {
// Method is present.
expect('typeof this.getField', 'function');
@@ -255,16 +247,6 @@ function testRemoveField() {
// TODO(tsepez): test success cases.
}
-function testRemoveIcon() {
- // Method is present.
- expect('typeof this.removeIcon', 'function');
-
- // Method requires at least one argument.
- expectError('this.removeIcon()');
-
- // TODO(tsepez): test success cases.
-}
-
function testResetForm() {
// Method is present.
expect('typeof this.resetForm', 'function');
@@ -290,6 +272,7 @@ try {
testUnsupported('this.addLink');
testUnsupported('this.closeDoc');
testUnsupported('this.createDataObject');
+ testUnsupported('this.deletePages');
testUnsupported('this.exportAsFDF');
testUnsupported('this.exportAsText');
testUnsupported('this.exportAsXFDF');
@@ -305,13 +288,13 @@ try {
testUnsupported('this.importAnXFDF');
testUnsupported('this.importTextData');
testUnsupported('this.insertPages');
+ testUnsupported('this.removeIcon');
testUnsupported('this.replacePages');
testUnsupported('this.saveAs');
app.alert('*** Testing Supported Methods ***');
testAddIcon();
testCalculateNow();
- testDeletePages();
testGetField();
testGetIcon();
testGetNthFieldName();
@@ -323,7 +306,6 @@ try {
testMailForm();
testPrint();
testRemoveField();
- testRemoveIcon();
testResetForm();
testSubmitForm();
} catch (e) {
diff --git a/testing/resources/javascript/document_methods_expected.txt b/testing/resources/javascript/document_methods_expected.txt
index 445b48d656..753a99df6e 100644
--- a/testing/resources/javascript/document_methods_expected.txt
+++ b/testing/resources/javascript/document_methods_expected.txt
@@ -14,6 +14,9 @@ Alert: PASS: this.closeDoc(1, 2, "clams", [1, 2, 3]) = undefined
Alert: PASS: typeof this.createDataObject = function
Alert: PASS: this.createDataObject() = undefined
Alert: PASS: this.createDataObject(1, 2, "clams", [1, 2, 3]) = undefined
+Alert: PASS: typeof this.deletePages = function
+Alert: PASS: this.deletePages() = undefined
+Alert: PASS: this.deletePages(1, 2, "clams", [1, 2, 3]) = undefined
Alert: PASS: typeof this.exportAsFDF = function
Alert: PASS: this.exportAsFDF() = undefined
Alert: PASS: this.exportAsFDF(1, 2, "clams", [1, 2, 3]) = undefined
@@ -59,6 +62,9 @@ Alert: PASS: this.importTextData(1, 2, "clams", [1, 2, 3]) = undefined
Alert: PASS: typeof this.insertPages = function
Alert: PASS: this.insertPages() = undefined
Alert: PASS: this.insertPages(1, 2, "clams", [1, 2, 3]) = undefined
+Alert: PASS: typeof this.removeIcon = function
+Alert: PASS: this.removeIcon() = undefined
+Alert: PASS: this.removeIcon(1, 2, "clams", [1, 2, 3]) = undefined
Alert: PASS: typeof this.replacePages = function
Alert: PASS: this.replacePages() = undefined
Alert: PASS: this.replacePages(1, 2, "clams", [1, 2, 3]) = undefined
@@ -72,7 +78,6 @@ Alert: PASS: this.addIcon(1) threw error Document.addIcon: Incorrect number of p
Alert: PASS: this.addIcon(1, 2, 3) threw error Document.addIcon: Incorrect number of parameters passed to function.
Alert: PASS: this.addIcon("myicon", 3) threw error Document.addIcon: Incorrect parameter type.
Alert: PASS: typeof this.calculateNow = function
-Alert: PASS: typeof this.deletePages = function
Alert: PASS: typeof this.getField = function
Alert: PASS: this.getField() threw error Document.getField: Incorrect number of parameters passed to function.
Alert: PASS: typeof this.getIcon = function
@@ -96,8 +101,6 @@ Alert: PASS: typeof this.mailForm = function
Alert: PASS: typeof this.print = function
Alert: PASS: typeof this.removeField = function
Alert: PASS: this.removeField() threw error Document.removeField: Incorrect number of parameters passed to function.
-Alert: PASS: typeof this.removeIcon = function
-Alert: PASS: this.removeIcon() threw error Document.removeIcon: Incorrect number of parameters passed to function.
Alert: PASS: typeof this.resetForm = function
Alert: PASS: typeof this.submitForm = function
Alert: PASS: this.submitForm() threw error Document.submitForm: Incorrect number of parameters passed to function.