summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_actionhandler.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-13 15:00:10 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-13 15:00:10 -0700
commit3342090d65e852f3f37a8f04d3fbe3ff2467d05c (patch)
tree04ea6a1adeae79279a4d4e0f147161c2b4601dcb /fpdfsdk/src/fsdk_actionhandler.cpp
parentf6c67325ebb931ecad6c0f0e90302d854db75900 (diff)
downloadpdfium-3342090d65e852f3f37a8f04d3fbe3ff2467d05c.tar.xz
Merge to XFA: Pass IJS_Runtime, not IJS_Context, to native object constructors.
Original Review URL: https://codereview.chromium.org/1389163007 . (cherry picked from commit 848a13b6777cbff8cc4aea3ab3d69eaa0b82ae6c) Merge conflics in: fpdfsdk/src/javascript/JS_Runtime.cpp fpdfsdk/src/javascript/JS_Runtime_Stub.cpp fpdfsdk/src/jsapi/fxjs_v8.cpp R=thestig@chromium.org Review URL: https://codereview.chromium.org/1394993006 .
Diffstat (limited to 'fpdfsdk/src/fsdk_actionhandler.cpp')
-rw-r--r--fpdfsdk/src/fsdk_actionhandler.cpp85
1 files changed, 12 insertions, 73 deletions
diff --git a/fpdfsdk/src/fsdk_actionhandler.cpp b/fpdfsdk/src/fsdk_actionhandler.cpp
index 6cb37b9c80..feb9a85137 100644
--- a/fpdfsdk/src/fsdk_actionhandler.cpp
+++ b/fpdfsdk/src/fsdk_actionhandler.cpp
@@ -149,18 +149,14 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction(const CPDF_Action& action,
if (pEnv->IsJSInitiated()) {
CFX_WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
- IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); //????
- ASSERT(pRuntime != NULL);
-
+ IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
pRuntime->SetReaderDocument(pDocument);
IJS_Context* pContext = pRuntime->NewContext();
- ASSERT(pContext != NULL);
-
pContext->OnLink_MouseUp(pDocument);
CFX_WideString csInfo;
- FX_BOOL bRet = pContext->RunScript(swJS, csInfo);
+ FX_BOOL bRet = pContext->RunScript(swJS, &csInfo);
if (!bRet) {
// FIXME: return error.
}
@@ -293,65 +289,13 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction(
CFX_WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
- ASSERT(pRuntime != NULL);
-
pRuntime->SetReaderDocument(pDocument);
IJS_Context* pContext = pRuntime->NewContext();
- ASSERT(pContext != NULL);
-
- // switch (type)
- // {
- // case CPDF_AAction::CursorEnter:
- // pContext->OnScreen_MouseEnter(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::CursorExit:
- // pContext->OnScreen_MouseExit(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::ButtonDown:
- // pContext->OnScreen_MouseDown(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::ButtonUp:
- // pContext->OnScreen_MouseUp(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::GetFocus:
- // pContext->OnScreen_Focus(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::LoseFocus:
- // pContext->OnScreen_Blur(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::PageOpen:
- // pContext->OnScreen_Open(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::PageClose:
- // pContext->OnScreen_Close(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::PageVisible:
- // pContext->OnScreen_InView(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // case CPDF_AAction::PageInvisible:
- // pContext->OnScreen_OutView(IsCTRLpressed(),
- // IsSHIFTpressed(), pScreen);
- // break;
- // default:
- // ASSERT(FALSE);
- // break;
- // }
-
CFX_WideString csInfo;
- FX_BOOL bRet = pContext->RunScript(swJS, csInfo);
+ FX_BOOL bRet = pContext->RunScript(swJS, &csInfo);
if (!bRet) {
- // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(),
- // csInfo);
+ // FIXME: return error.
}
pRuntime->ReleaseContext(pContext);
@@ -389,20 +333,15 @@ FX_BOOL CPDFSDK_ActionHandler::ExecuteBookMark(const CPDF_Action& action,
CFX_WideString swJS = action.GetJavaScript();
if (!swJS.IsEmpty()) {
IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
- ASSERT(pRuntime != NULL);
-
pRuntime->SetReaderDocument(pDocument);
IJS_Context* pContext = pRuntime->NewContext();
- ASSERT(pContext != NULL);
-
pContext->OnBookmark_MouseUp(pBookmark);
CFX_WideString csInfo;
- FX_BOOL bRet = pContext->RunScript(swJS, csInfo);
+ FX_BOOL bRet = pContext->RunScript(swJS, &csInfo);
if (!bRet) {
- // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(),
- // csInfo);
+ // FIXME: return error.
}
pRuntime->ReleaseContext(pContext);
@@ -602,9 +541,9 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript(CPDFSDK_Document* pDocument,
}
CFX_WideString csInfo;
- FX_BOOL bRet = pContext->RunScript(script, csInfo);
+ FX_BOOL bRet = pContext->RunScript(script, &csInfo);
if (!bRet) {
- // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo);
+ // FIXME: return error.
}
pRuntime->ReleaseContext(pContext);
@@ -627,9 +566,9 @@ void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript(
pContext->OnDoc_Open(pDocument, sScriptName);
CFX_WideString csInfo;
- FX_BOOL bRet = pContext->RunScript(script, csInfo);
+ FX_BOOL bRet = pContext->RunScript(script, &csInfo);
if (!bRet) {
- // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo);
+ // FIXME: return error.
}
pRuntime->ReleaseContext(pContext);
@@ -683,9 +622,9 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript(
}
CFX_WideString csInfo;
- FX_BOOL bRet = pContext->RunScript(script, csInfo);
+ FX_BOOL bRet = pContext->RunScript(script, &csInfo);
if (!bRet) {
- // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo);
+ // FIXME: return error.
}
pRuntime->ReleaseContext(pContext);