summaryrefslogtreecommitdiff
path: root/fxjs/cjs_event.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-06-08 18:23:05 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-08 18:23:05 +0000
commit1699982f45d01cb18585eba80cce5326a63d3b67 (patch)
tree537d81d989632bab75fda37f5b587e1309e60d5d /fxjs/cjs_event.cpp
parentf29479d47156d180c0b71f6c98aa4de37c2a7ee2 (diff)
downloadpdfium-1699982f45d01cb18585eba80cce5326a63d3b67.tar.xz
Ensure CJS_Return() with error always includes a message.
Change the signature of the constructors to make it impossible to do this otherwise. Change-Id: I14e88d98a1128f2d599459ce9337cd6d079469fe Reviewed-on: https://pdfium-review.googlesource.com/34531 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_event.cpp')
-rw-r--r--fxjs/cjs_event.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/fxjs/cjs_event.cpp b/fxjs/cjs_event.cpp
index de22ab8488..841d9001cb 100644
--- a/fxjs/cjs_event.cpp
+++ b/fxjs/cjs_event.cpp
@@ -68,7 +68,7 @@ CJS_Return CJS_Event::set_change(CJS_Runtime* pRuntime,
WideString& wChange = pEvent->Change();
wChange = pRuntime->ToWideString(vp);
}
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::get_change_ex(CJS_Runtime* pRuntime) {
@@ -82,7 +82,7 @@ CJS_Return CJS_Event::get_change_ex(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_change_ex(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_commit_key(CJS_Runtime* pRuntime) {
@@ -96,7 +96,7 @@ CJS_Return CJS_Event::get_commit_key(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_commit_key(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_field_full(CJS_Runtime* pRuntime) {
@@ -106,14 +106,14 @@ CJS_Return CJS_Event::get_field_full(CJS_Runtime* pRuntime) {
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
- return CJS_Return(false);
+ return CJS_Return(L"unrecognized event");
return CJS_Return(pRuntime->NewBoolean(pEvent->FieldFull()));
}
CJS_Return CJS_Event::set_field_full(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_key_down(CJS_Runtime* pRuntime) {
@@ -124,7 +124,7 @@ CJS_Return CJS_Event::get_key_down(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_key_down(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_modifier(CJS_Runtime* pRuntime) {
@@ -135,7 +135,7 @@ CJS_Return CJS_Event::get_modifier(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_modifier(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_name(CJS_Runtime* pRuntime) {
@@ -145,7 +145,7 @@ CJS_Return CJS_Event::get_name(CJS_Runtime* pRuntime) {
}
CJS_Return CJS_Event::set_name(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_rc(CJS_Runtime* pRuntime) {
@@ -158,34 +158,34 @@ CJS_Return CJS_Event::set_rc(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
pEvent->Rc() = pRuntime->ToBoolean(vp);
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::get_rich_change(CJS_Runtime* pRuntime) {
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::set_rich_change(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::get_rich_change_ex(CJS_Runtime* pRuntime) {
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::set_rich_change_ex(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::get_rich_value(CJS_Runtime* pRuntime) {
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::set_rich_value(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::get_sel_end(CJS_Runtime* pRuntime) {
@@ -193,7 +193,7 @@ CJS_Return CJS_Event::get_sel_end(CJS_Runtime* pRuntime) {
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
- return CJS_Return(true);
+ return CJS_Return();
return CJS_Return(pRuntime->NewNumber(pEvent->SelEnd()));
}
@@ -204,10 +204,10 @@ CJS_Return CJS_Event::set_sel_end(CJS_Runtime* pRuntime,
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
- return CJS_Return(true);
+ return CJS_Return();
pEvent->SetSelEnd(pRuntime->ToInt32(vp));
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::get_sel_start(CJS_Runtime* pRuntime) {
@@ -215,7 +215,7 @@ CJS_Return CJS_Event::get_sel_start(CJS_Runtime* pRuntime) {
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
- return CJS_Return(true);
+ return CJS_Return();
return CJS_Return(pRuntime->NewNumber(pEvent->SelStart()));
}
@@ -226,10 +226,10 @@ CJS_Return CJS_Event::set_sel_start(CJS_Runtime* pRuntime,
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
- return CJS_Return(true);
+ return CJS_Return();
pEvent->SetSelStart(pRuntime->ToInt32(vp));
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::get_shift(CJS_Runtime* pRuntime) {
@@ -240,7 +240,7 @@ CJS_Return CJS_Event::get_shift(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_shift(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_source(CJS_Runtime* pRuntime) {
@@ -251,7 +251,7 @@ CJS_Return CJS_Event::get_source(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_source(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_target(CJS_Runtime* pRuntime) {
@@ -264,7 +264,7 @@ CJS_Return CJS_Event::get_target(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_target(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_target_name(CJS_Runtime* pRuntime) {
@@ -277,7 +277,7 @@ CJS_Return CJS_Event::get_target_name(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_target_name(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_type(CJS_Runtime* pRuntime) {
@@ -289,7 +289,7 @@ CJS_Return CJS_Event::get_type(CJS_Runtime* pRuntime) {
}
CJS_Return CJS_Event::set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}
CJS_Return CJS_Event::get_value(CJS_Runtime* pRuntime) {
@@ -299,10 +299,10 @@ CJS_Return CJS_Event::get_value(CJS_Runtime* pRuntime) {
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0)
- return CJS_Return(false);
+ return CJS_Return(L"Bad event type.");
if (!pEvent->m_pValue)
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kBadObjectError);
return CJS_Return(pRuntime->NewString(pEvent->Value().c_str()));
}
@@ -315,13 +315,13 @@ CJS_Return CJS_Event::set_value(CJS_Runtime* pRuntime,
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0)
- return CJS_Return(false);
+ return CJS_Return(L"Bad event type.");
if (!pEvent->m_pValue)
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kBadObjectError);
pEvent->Value() = pRuntime->ToWideString(vp);
- return CJS_Return(true);
+ return CJS_Return();
}
CJS_Return CJS_Event::get_will_commit(CJS_Runtime* pRuntime) {
@@ -334,5 +334,5 @@ CJS_Return CJS_Event::get_will_commit(CJS_Runtime* pRuntime) {
CJS_Return CJS_Event::set_will_commit(CJS_Runtime* pRuntime,
v8::Local<v8::Value> vp) {
- return CJS_Return(false);
+ return CJS_Return(JSMessage::kNotSupportedError);
}