summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-09-24 17:23:27 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-24 17:23:27 +0000
commit97f4483de007c2ff248696f24d34634e0adbf894 (patch)
tree7defaedcdad0f06b8a870164fd2bee9200b347ac /fpdfsdk
parentf07e487a1a6d5c1588b1d1dfd5c25fa5b91f73ca (diff)
downloadpdfium-97f4483de007c2ff248696f24d34634e0adbf894.tar.xz
Revert "Make potentially dangerous Actions require a user click."
This reverts commit 9d784c291714b703b16185e69860a3797de85b6c. Reason for revert: Roll into chromium is stuck, this is a potential culprit. Original change's description: > Make potentially dangerous Actions require a user click. > > URI and SubmitForm actions are only handled if the event was > ButtonUp or ButtonDown. > > Bug: 851821 > Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d > Reviewed-on: https://pdfium-review.googlesource.com/42731 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> TBR=tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 851821 Change-Id: I6f1bc0a02f65a24fbd49d53526b985f8a4ea0b4f Reviewed-on: https://pdfium-review.googlesource.com/42990 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_actionhandler.cpp31
-rw-r--r--fpdfsdk/cpdfsdk_actionhandler.h4
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp1
-rw-r--r--fpdfsdk/fpdf_formfill_embeddertest.cpp19
4 files changed, 12 insertions, 43 deletions
diff --git a/fpdfsdk/cpdfsdk_actionhandler.cpp b/fpdfsdk/cpdfsdk_actionhandler.cpp
index f98585f2a1..f951bfb9fe 100644
--- a/fpdfsdk/cpdfsdk_actionhandler.cpp
+++ b/fpdfsdk/cpdfsdk_actionhandler.cpp
@@ -82,7 +82,7 @@ bool CPDFSDK_ActionHandler::DoAction_BookMark(
CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv) {
std::set<const CPDF_Dictionary*> visited;
- return ExecuteBookMark(action, type, pFormFillEnv, pBookMark, &visited);
+ return ExecuteBookMark(action, pFormFillEnv, pBookMark, &visited);
}
bool CPDFSDK_ActionHandler::DoAction_Screen(
@@ -96,10 +96,9 @@ bool CPDFSDK_ActionHandler::DoAction_Screen(
bool CPDFSDK_ActionHandler::DoAction_Link(
const CPDF_Action& action,
- CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv) {
std::set<const CPDF_Dictionary*> visited;
- return ExecuteLinkAction(action, type, pFormFillEnv, &visited);
+ return ExecuteLinkAction(action, pFormFillEnv, &visited);
}
bool CPDFSDK_ActionHandler::DoAction_Field(
@@ -131,8 +130,7 @@ bool CPDFSDK_ActionHandler::ExecuteDocumentOpenAction(
RunDocumentOpenJavaScript(pFormFillEnv, L"", swJS);
}
} else {
- DoAction_NoJs(action, CPDF_AAction::AActionType::DocumentOpen,
- pFormFillEnv);
+ DoAction_NoJs(action, pFormFillEnv);
}
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
@@ -146,7 +144,6 @@ bool CPDFSDK_ActionHandler::ExecuteDocumentOpenAction(
bool CPDFSDK_ActionHandler::ExecuteLinkAction(
const CPDF_Action& action,
- CPDF_AAction::AActionType eType,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
std::set<const CPDF_Dictionary*>* visited) {
const CPDF_Dictionary* pDict = action.GetDict();
@@ -162,12 +159,12 @@ bool CPDFSDK_ActionHandler::ExecuteLinkAction(
context->OnLink_MouseUp(pFormFillEnv);
});
} else {
- DoAction_NoJs(action, eType, pFormFillEnv);
+ DoAction_NoJs(action, pFormFillEnv);
}
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
CPDF_Action subaction = action.GetSubAction(i);
- if (!ExecuteLinkAction(subaction, eType, pFormFillEnv, visited))
+ if (!ExecuteLinkAction(subaction, pFormFillEnv, visited))
return false;
}
@@ -193,7 +190,7 @@ bool CPDFSDK_ActionHandler::ExecuteDocumentPageAction(
RunDocumentPageJavaScript(pFormFillEnv, type, swJS);
}
} else {
- DoAction_NoJs(action, type, pFormFillEnv);
+ DoAction_NoJs(action, pFormFillEnv);
}
ASSERT(pFormFillEnv);
@@ -241,7 +238,7 @@ bool CPDFSDK_ActionHandler::ExecuteFieldAction(
}
}
} else {
- DoAction_NoJs(action, type, pFormFillEnv);
+ DoAction_NoJs(action, pFormFillEnv);
}
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
@@ -270,7 +267,7 @@ bool CPDFSDK_ActionHandler::ExecuteScreenAction(
if (action.GetType() == CPDF_Action::JavaScript)
RunScriptForAction(action, pFormFillEnv, [](IJS_EventContext*) {});
else
- DoAction_NoJs(action, type, pFormFillEnv);
+ DoAction_NoJs(action, pFormFillEnv);
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
CPDF_Action subaction = action.GetSubAction(i);
@@ -283,7 +280,6 @@ bool CPDFSDK_ActionHandler::ExecuteScreenAction(
bool CPDFSDK_ActionHandler::ExecuteBookMark(
const CPDF_Action& action,
- CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_Bookmark* pBookmark,
std::set<const CPDF_Dictionary*>* visited) {
@@ -300,12 +296,12 @@ bool CPDFSDK_ActionHandler::ExecuteBookMark(
context->OnBookmark_MouseUp(pBookmark);
});
} else {
- DoAction_NoJs(action, type, pFormFillEnv);
+ DoAction_NoJs(action, pFormFillEnv);
}
for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
CPDF_Action subaction = action.GetSubAction(i);
- if (!ExecuteBookMark(subaction, type, pFormFillEnv, pBookmark, visited))
+ if (!ExecuteBookMark(subaction, pFormFillEnv, pBookmark, visited))
return false;
}
@@ -314,7 +310,6 @@ bool CPDFSDK_ActionHandler::ExecuteBookMark(
void CPDFSDK_ActionHandler::DoAction_NoJs(
const CPDF_Action& action,
- CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv) {
ASSERT(pFormFillEnv);
@@ -323,8 +318,7 @@ void CPDFSDK_ActionHandler::DoAction_NoJs(
DoAction_GoTo(pFormFillEnv, action);
break;
case CPDF_Action::URI:
- if (CPDF_AAction::IsUserClick(type))
- DoAction_URI(pFormFillEnv, action);
+ DoAction_URI(pFormFillEnv, action);
break;
case CPDF_Action::Hide:
DoAction_Hide(action, pFormFillEnv);
@@ -333,8 +327,7 @@ void CPDFSDK_ActionHandler::DoAction_NoJs(
DoAction_Named(pFormFillEnv, action);
break;
case CPDF_Action::SubmitForm:
- if (CPDF_AAction::IsUserClick(type))
- DoAction_SubmitForm(action, pFormFillEnv);
+ DoAction_SubmitForm(action, pFormFillEnv);
break;
case CPDF_Action::ResetForm:
DoAction_ResetForm(action, pFormFillEnv);
diff --git a/fpdfsdk/cpdfsdk_actionhandler.h b/fpdfsdk/cpdfsdk_actionhandler.h
index 94b347f630..14cbc9c5c5 100644
--- a/fpdfsdk/cpdfsdk_actionhandler.h
+++ b/fpdfsdk/cpdfsdk_actionhandler.h
@@ -44,7 +44,6 @@ class CPDFSDK_ActionHandler {
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDFSDK_Annot* pScreen);
bool DoAction_Link(const CPDF_Action& action,
- CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv);
bool DoAction_Field(const CPDF_Action& action,
CPDF_AAction::AActionType type,
@@ -86,17 +85,14 @@ class CPDFSDK_ActionHandler {
CPDFSDK_Annot* pScreen,
std::set<const CPDF_Dictionary*>* visited);
bool ExecuteBookMark(const CPDF_Action& action,
- CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_Bookmark* pBookmark,
std::set<const CPDF_Dictionary*>* visited);
bool ExecuteLinkAction(const CPDF_Action& action,
- CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
std::set<const CPDF_Dictionary*>* visited);
void DoAction_NoJs(const CPDF_Action& action,
- CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv);
void RunDocumentPageJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_AAction::AActionType type,
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index 82776e3298..8bd1f10177 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -174,7 +174,6 @@ static XFA_EVENTTYPE GetXFAEventType(CPDF_AAction::AActionType eAAT,
case CPDF_AAction::PrintDocument:
case CPDF_AAction::DocumentPrinted:
break;
- case CPDF_AAction::DocumentOpen:
case CPDF_AAction::NumberOfActions:
NOTREACHED();
break;
diff --git a/fpdfsdk/fpdf_formfill_embeddertest.cpp b/fpdfsdk/fpdf_formfill_embeddertest.cpp
index 3e53753b48..8ff3a84291 100644
--- a/fpdfsdk/fpdf_formfill_embeddertest.cpp
+++ b/fpdfsdk/fpdf_formfill_embeddertest.cpp
@@ -379,25 +379,6 @@ TEST_F(FPDFFormFillEmbeddertest, BUG_514690) {
UnloadPage(page);
}
-class DoURIActionBlockedDelegate final : public EmbedderTest::Delegate {
- public:
- void DoURIAction(FPDF_BYTESTRING uri) override {
- FAIL() << "Navigated to " << uri;
- }
-};
-
-TEST_F(FPDFFormFillEmbeddertest, BUG_851821) {
- DoURIActionBlockedDelegate delegate;
- SetDelegate(&delegate);
-
- EXPECT_TRUE(OpenDocument("redirect.pdf"));
- FPDF_PAGE page = LoadPage(0);
- EXPECT_TRUE(page);
- DoOpenActions();
-
- UnloadPage(page);
-}
-
#ifdef PDF_ENABLE_V8
TEST_F(FPDFFormFillEmbeddertest, DisableJavaScript) {
// Test that timers and intervals can't fire without JS.