From 3b73a3baf3fc3e894b34c59507278169304ddcfd Mon Sep 17 00:00:00 2001
From: Pawel Andruszkiewicz
Date: Wed, 3 Jun 2015 09:24:33 +0200
Subject: [PATCH] [Badge] Fixed validation of arguments.
[Verification] TCT pass rate: 26/26.
Change-Id: Ie4c3d25607533fad864e1b6e129afff53c45cfa4
Signed-off-by: Pawel Andruszkiewicz
---
src/badge/badge_api.js | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/src/badge/badge_api.js b/src/badge/badge_api.js
index c380453b..4a2ab7c1 100755
--- a/src/badge/badge_api.js
+++ b/src/badge/badge_api.js
@@ -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',
--
2.34.1