[SystemInfo] Added validation of setBrightness value
authorWojciech Kosowicz <w.kosowicz@samsung.com>
Mon, 14 Sep 2015 12:14:23 +0000 (14:14 +0200)
committerJeongKyun Pu <jk.pu@samsung.com>
Tue, 15 Sep 2015 06:08:39 +0000 (15:08 +0900)
Change-Id: I8cd6135f7ec4abc5d2a1c6bc0847204715ae5b8f
Signed-off-by: Wojciech Kosowicz <w.kosowicz@samsung.com>
src/systeminfo/systeminfo_api.js

index 17ce10f..7294898 100644 (file)
@@ -709,6 +709,9 @@ SystemInfoCameraFlash.prototype.setBrightness = function(brightness) {
   var args = validator_.validateArgs(arguments, [
     {name: 'brightness', type: types_.DOUBLE}
   ]);
+  if (args.brightness < 0 || args.brightness > 1)
+    throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
+                              'Value is not between 0 and 1');
   args.brightness = args.brightness * this.levels;
 
   var result = native_.callSync('SystemInfo_setBrightness', args);