[Badge] Fixed validation of arguments.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Wed, 3 Jun 2015 07:24:33 +0000 (09:24 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Wed, 3 Jun 2015 07:24:33 +0000 (09:24 +0200)
[Verification] TCT pass rate: 26/26.

Change-Id: Ie4c3d25607533fad864e1b6e129afff53c45cfa4
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/badge/badge_api.js

index c380453bc98f2e200b15cd21f4133cc90613e436..4a2ab7c1373effeeec0d0d3662f6214297914cb1 100755 (executable)
@@ -58,18 +58,15 @@ function BadgeManager() {
 BadgeManager.prototype.setBadgeCount = function() {
   xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
 
-  if (arguments.length < 2)
-    throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
-        'incorrect number of arguments');
-
   var args = validator_.validateArgs(arguments, [
     {name: 'appId', type: types_.STRING},
     {name: 'count', type: types_.LONG}
   ]);
 
-  if (args.count < 0)
+  if (args.count < 0) {
     throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
-                                    'Count parameter is negative!');
+                              'Count parameter is negative!');
+  }
 
   var ret = native_.callSync('BadgeManager_setBadgeCount', {
     appId: args.appId,
@@ -89,9 +86,6 @@ BadgeManager.prototype.setBadgeCount = function() {
 BadgeManager.prototype.getBadgeCount = function() {
   xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
 
-  if (arguments.length < 1)
-    throw new WebAPIException(WebAPIException.INVALID_VALUES_ERR,
-                                    'incorrect number of arguments');
   var args = validator_.validateArgs(arguments, [
     {name: 'appId', type: types_.STRING}
   ]);
@@ -114,9 +108,6 @@ BadgeManager.prototype.getBadgeCount = function() {
 BadgeManager.prototype.addChangeListener = function() {
   xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
 
-  if (arguments.length < 2)
-    throw new WebAPIException(WebAPIException.TYPE_MISMATCH_ERR,
-        'incorrect number of arguments');
   var args = validator_.validateArgs(arguments, [
     {
       name: 'appIdList',
@@ -158,10 +149,6 @@ BadgeManager.prototype.addChangeListener = function() {
 BadgeManager.prototype.removeChangeListener = function() {
   xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.NOTIFICATION);
 
-  if (arguments.length < 1)
-    throw new WebAPIException(WebAPIException.TYPE_MISMATCH_ERR,
-                                    'incorrect number of arguments');
-
   var args = validator_.validateArgs(arguments, [
     {
       name: 'appIdList',