Make CJS_EventHandler::Name() and Type() return bytestrings.
Change-Id: Iecef3fad824683ff938f4e5eb7a47997153675fa
Reviewed-on: https://pdfium-review.googlesource.com/c/46250
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/fxjs/cjs_event.cpp b/fxjs/cjs_event.cpp
index f1eeae0..a4a7592 100644
--- a/fxjs/cjs_event.cpp
+++ b/fxjs/cjs_event.cpp
@@ -99,7 +99,7 @@
CJS_Result CJS_Event::get_field_full(CJS_Runtime* pRuntime) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
- if (wcscmp(pEvent->Name(), L"Keystroke") != 0)
+ if (pEvent->Name() != "Keystroke")
return CJS_Result::Failure(L"unrecognized event");
return CJS_Result::Success(pRuntime->NewBoolean(pEvent->FieldFull()));
@@ -185,8 +185,7 @@
CJS_Result CJS_Event::get_sel_end(CJS_Runtime* pRuntime) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
-
- if (wcscmp(pEvent->Name(), L"Keystroke") != 0)
+ if (pEvent->Name() != "Keystroke")
return CJS_Result::Success();
return CJS_Result::Success(pRuntime->NewNumber(pEvent->SelEnd()));
@@ -196,8 +195,7 @@
v8::Local<v8::Value> vp) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
-
- if (wcscmp(pEvent->Name(), L"Keystroke") == 0)
+ if (pEvent->Name() == "Keystroke")
pEvent->SetSelEnd(pRuntime->ToInt32(vp));
return CJS_Result::Success();
@@ -206,8 +204,7 @@
CJS_Result CJS_Event::get_sel_start(CJS_Runtime* pRuntime) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
-
- if (wcscmp(pEvent->Name(), L"Keystroke") != 0)
+ if (pEvent->Name() != "Keystroke")
return CJS_Result::Success();
return CJS_Result::Success(pRuntime->NewNumber(pEvent->SelStart()));
@@ -217,8 +214,7 @@
v8::Local<v8::Value> vp) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
-
- if (wcscmp(pEvent->Name(), L"Keystroke") == 0)
+ if (pEvent->Name() == "Keystroke")
pEvent->SetSelStart(pRuntime->ToInt32(vp));
return CJS_Result::Success();
@@ -282,8 +278,7 @@
CJS_Result CJS_Event::get_value(CJS_Runtime* pRuntime) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
-
- if (wcscmp(pEvent->Type(), L"Field") != 0)
+ if (pEvent->Type() != "Field")
return CJS_Result::Failure(L"Bad event type.");
if (!pEvent->m_pValue)
@@ -297,8 +292,7 @@
v8::Local<v8::Value> vp) {
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
-
- if (wcscmp(pEvent->Type(), L"Field") != 0)
+ if (pEvent->Type() != "Field")
return CJS_Result::Failure(L"Bad event type.");
if (!pEvent->m_pValue)