]> khamidou — GitHub mirrors - electron.git/commitdiff
Fix wrong return values in a few converters
authorCheng Zhao <zcbenz@gmail.com>
Fri, 18 Sep 2015 10:21:51 +0000 (18:21 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 18 Sep 2015 10:21:51 +0000 (18:21 +0800)
atom/browser/api/atom_api_web_contents.cc
atom/common/native_mate_converters/blink_converter.cc

index 1a9ffeb67fae04397cb8bd27a0b9db8231d4f341..9791a94bb77bfaa4c1dd324d79a9da609e5eeb6c 100644 (file)
@@ -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(
index a406059cf6295bab88429d69b57e7e1836b49836..67c7e7e95fd8f0b09ecfeb87dd0ff993958d9a58 100644 (file)
@@ -73,7 +73,7 @@ struct Converter<blink::WebInputEvent::Type> {
       *out = blink::WebInputEvent::TouchEnd;
     else if (type == "touchcancel")
       *out = blink::WebInputEvent::TouchCancel;
-    return false;
+    return true;
   }
 };
 
@@ -108,12 +108,12 @@ struct Converter<blink::WebInputEvent::Modifiers> {
       *out = blink::WebInputEvent::IsLeft;
     else if (modifier == "right")
       *out = blink::WebInputEvent::IsRight;
-    return false;
+    return true;
   }
 };
 
 int GetWebInputEventType(v8::Isolate* isolate, v8::Local<v8::Value> 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<blink::WebKeyboardEvent>::FromV8(
   if (shifted)
     out->modifiers |= blink::WebInputEvent::ShiftKey;
   out->setKeyIdentifierFromWindowsKeyCode();
-  return false;
+  return true;
 }
 
 bool Converter<content::NativeWebKeyboardEvent>::FromV8(
@@ -164,7 +164,7 @@ bool Converter<content::NativeWebKeyboardEvent>::FromV8(
   if (!ConvertFromV8(isolate, val, static_cast<blink::WebKeyboardEvent*>(out)))
     return false;
   dict.Get("skipInBrowser", &out->skip_in_browser);
-  return false;
+  return true;
 }
 
 bool Converter<blink::WebMouseEvent>::FromV8(
@@ -181,7 +181,7 @@ bool Converter<blink::WebMouseEvent>::FromV8(
   dict.Get("movementX", &out->movementX);
   dict.Get("movementY", &out->movementY);
   dict.Get("clickCount", &out->clickCount);
-  return false;
+  return true;
 }
 
 bool Converter<blink::WebMouseWheelEvent>::FromV8(
@@ -200,7 +200,7 @@ bool Converter<blink::WebMouseWheelEvent>::FromV8(
   dict.Get("accelerationRatioY", &out->accelerationRatioY);
   dict.Get("hasPreciseScrollingDeltas", &out->hasPreciseScrollingDeltas);
   dict.Get("canScroll", &out->canScroll);
-  return false;
+  return true;
 }
 
 bool Converter<blink::WebFloatPoint>::FromV8(