From: Wojciech Kosowicz Date: Mon, 14 Sep 2015 12:14:23 +0000 (+0200) Subject: [SystemInfo] Added validation of setBrightness value X-Git-Tag: submit/tizen/20150916.015449^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=433c3c0f74fae4b195f82ac13c1eeefee74eff51;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [SystemInfo] Added validation of setBrightness value Change-Id: I8cd6135f7ec4abc5d2a1c6bc0847204715ae5b8f Signed-off-by: Wojciech Kosowicz --- diff --git a/src/systeminfo/systeminfo_api.js b/src/systeminfo/systeminfo_api.js index 17ce10fa..72948986 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);