From ab98ec32c48bb90a6d4e75000bcf0da5c7ba898f Mon Sep 17 00:00:00 2001 From: Wojciech Kosowicz Date: Mon, 14 Sep 2015 14:14:23 +0200 Subject: [PATCH] [SystemInfo] Added validation of setBrightness value Change-Id: I8cd6135f7ec4abc5d2a1c6bc0847204715ae5b8f Signed-off-by: Wojciech Kosowicz --- src/systeminfo/systeminfo_api.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/systeminfo/systeminfo_api.js b/src/systeminfo/systeminfo_api.js index 17ce10f..7294898 100644 --- a/src/systeminfo/systeminfo_api.js +++ b/src/systeminfo/systeminfo_api.js @@ -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); -- 2.7.4