summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/event.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-24 09:36:16 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-24 17:17:03 +0000
commite49749265c4e503c37a316e4ca6eeff430d13b87 (patch)
treed75c0b641618e66477b2e992ae146f30a3e2dd9f /fpdfsdk/javascript/event.cpp
parent826480cf599f61fe0366ab2bd5803dd53c9d0562 (diff)
downloadpdfium-e49749265c4e503c37a316e4ca6eeff430d13b87.tar.xz
Remove most CJS_Value Set methods
This CL removes all of the Set(*) methods from CJS_Value except for Set(v8::Local<v8::Value>). All uses of Set are changed to convert to a v8::Value before setting. Change-Id: I6e4d2cebec42fce5c039dc0a3abe46086cfdd34f Reviewed-on: https://pdfium-review.googlesource.com/16610 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/event.cpp')
-rw-r--r--fpdfsdk/javascript/event.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp
index 11b8b01f6d..361afa8cff 100644
--- a/fpdfsdk/javascript/event.cpp
+++ b/fpdfsdk/javascript/event.cpp
@@ -51,7 +51,7 @@ bool event::get_change(CJS_Runtime* pRuntime,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->Change());
+ vp->Set(pRuntime->NewString(pEvent->Change().c_str()));
return true;
}
@@ -74,7 +74,7 @@ bool event::get_change_ex(CJS_Runtime* pRuntime,
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->ChangeEx());
+ vp->Set(pRuntime->NewString(pEvent->ChangeEx().c_str()));
return true;
}
@@ -90,7 +90,7 @@ bool event::get_commit_key(CJS_Runtime* pRuntime,
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->CommitKey());
+ vp->Set(pRuntime->NewNumber(pEvent->CommitKey()));
return true;
}
@@ -109,7 +109,7 @@ bool event::get_field_full(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return false;
- vp->Set(pRuntime, pEvent->FieldFull());
+ vp->Set(pRuntime->NewBoolean(pEvent->FieldFull()));
return true;
}
@@ -124,7 +124,7 @@ bool event::get_key_down(CJS_Runtime* pRuntime,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->KeyDown());
+ vp->Set(pRuntime->NewBoolean(pEvent->KeyDown()));
return true;
}
@@ -139,7 +139,7 @@ bool event::get_modifier(CJS_Runtime* pRuntime,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->Modifier());
+ vp->Set(pRuntime->NewBoolean(pEvent->Modifier()));
return true;
}
@@ -152,7 +152,7 @@ bool event::set_modifier(CJS_Runtime* pRuntime,
bool event::get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->Name());
+ vp->Set(pRuntime->NewString(pEvent->Name()));
return true;
}
@@ -165,7 +165,7 @@ bool event::set_name(CJS_Runtime* pRuntime,
bool event::get_rc(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->Rc());
+ vp->Set(pRuntime->NewBoolean(pEvent->Rc()));
return true;
}
@@ -223,7 +223,7 @@ bool event::get_sel_end(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return true;
- vp->Set(pRuntime, pEvent->SelEnd());
+ vp->Set(pRuntime->NewNumber(pEvent->SelEnd()));
return true;
}
@@ -249,7 +249,7 @@ bool event::get_sel_start(CJS_Runtime* pRuntime,
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
return true;
- vp->Set(pRuntime, pEvent->SelStart());
+ vp->Set(pRuntime->NewNumber(pEvent->SelStart()));
return true;
}
@@ -271,7 +271,7 @@ bool event::get_shift(CJS_Runtime* pRuntime,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->Shift());
+ vp->Set(pRuntime->NewBoolean(pEvent->Shift()));
return true;
}
@@ -286,7 +286,7 @@ bool event::get_source(CJS_Runtime* pRuntime,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->Source()->GetJSObject());
+ vp->Set(pEvent->Source()->GetJSObject()->ToV8Object());
return true;
}
@@ -301,7 +301,7 @@ bool event::get_target(CJS_Runtime* pRuntime,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->Target_Field()->GetJSObject());
+ vp->Set(pEvent->Target_Field()->GetJSObject()->ToV8Object());
return true;
}
@@ -316,7 +316,7 @@ bool event::get_target_name(CJS_Runtime* pRuntime,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->TargetName());
+ vp->Set(pRuntime->NewString(pEvent->TargetName().c_str()));
return true;
}
@@ -329,7 +329,7 @@ bool event::set_target_name(CJS_Runtime* pRuntime,
bool event::get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->Type());
+ vp->Set(pRuntime->NewString(pEvent->Type()));
return true;
}
@@ -351,7 +351,7 @@ bool event::get_value(CJS_Runtime* pRuntime,
if (!pEvent->m_pValue)
return false;
- vp->Set(pRuntime, pEvent->Value());
+ vp->Set(pRuntime->NewString(pEvent->Value().c_str()));
return true;
}
@@ -376,7 +376,7 @@ bool event::get_will_commit(CJS_Runtime* pRuntime,
WideString* sError) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- vp->Set(pRuntime, pEvent->WillCommit());
+ vp->Set(pRuntime->NewBoolean(pEvent->WillCommit()));
return true;
}