From 7b2980434c7970695165deaf47ecaea5ae0f1740 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 18 Sep 2015 18:21:51 +0800 Subject: [PATCH] Fix wrong return values in a few converters --- atom/browser/api/atom_api_web_contents.cc | 2 +- .../native_mate_converters/blink_converter.cc | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 1a9ffeb67fae..9791a94bb77b 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -847,7 +847,7 @@ void WebContents::SendInputEvent(v8::Isolate* isolate, } isolate->ThrowException(v8::Exception::Error(mate::StringToV8( - isolate, "Invalid event type"))); + isolate, "Invalid event object"))); } void WebContents::BeginFrameSubscription( diff --git a/atom/common/native_mate_converters/blink_converter.cc b/atom/common/native_mate_converters/blink_converter.cc index a406059cf629..67c7e7e95fd8 100644 --- a/atom/common/native_mate_converters/blink_converter.cc +++ b/atom/common/native_mate_converters/blink_converter.cc @@ -73,7 +73,7 @@ struct Converter { *out = blink::WebInputEvent::TouchEnd; else if (type == "touchcancel") *out = blink::WebInputEvent::TouchCancel; - return false; + return true; } }; @@ -108,12 +108,12 @@ struct Converter { *out = blink::WebInputEvent::IsLeft; else if (modifier == "right") *out = blink::WebInputEvent::IsRight; - return false; + return true; } }; int GetWebInputEventType(v8::Isolate* isolate, v8::Local val) { - int type = -1; + blink::WebInputEvent::Type type = blink::WebInputEvent::Undefined; mate::Dictionary dict; ConvertFromV8(isolate, val, &dict) && dict.Get("type", &type); return type; @@ -152,7 +152,7 @@ bool Converter::FromV8( if (shifted) out->modifiers |= blink::WebInputEvent::ShiftKey; out->setKeyIdentifierFromWindowsKeyCode(); - return false; + return true; } bool Converter::FromV8( @@ -164,7 +164,7 @@ bool Converter::FromV8( if (!ConvertFromV8(isolate, val, static_cast(out))) return false; dict.Get("skipInBrowser", &out->skip_in_browser); - return false; + return true; } bool Converter::FromV8( @@ -181,7 +181,7 @@ bool Converter::FromV8( dict.Get("movementX", &out->movementX); dict.Get("movementY", &out->movementY); dict.Get("clickCount", &out->clickCount); - return false; + return true; } bool Converter::FromV8( @@ -200,7 +200,7 @@ bool Converter::FromV8( dict.Get("accelerationRatioY", &out->accelerationRatioY); dict.Get("hasPreciseScrollingDeltas", &out->hasPreciseScrollingDeltas); dict.Get("canScroll", &out->canScroll); - return false; + return true; } bool Converter::FromV8(