From: Jakub Skowron Date: Wed, 17 Jan 2018 13:27:09 +0000 (+0100) Subject: [Utils] Fix Long conversion (allow hex string value) X-Git-Tag: submit/tizen_4.0/20180126.102411^2~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1129a8f18c453f8be2765f034314bb04bb6fa66a;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Utils] Fix Long conversion (allow hex string value) Until now string "0x15" would be converted 0. This change affects all numeric conversions which use _toLong. According to https://www.w3.org/TR/WebIDL-1/#es-long value should be initialized by ToNumber, which is defined in https://tc39.github.io/ecma262/#sec-tonumber-applied-to-the-string-type and allows value to be in form of HexIntegerLiteral. Change-Id: Ib719ce8fd5beccc5947b761dc905c49ac0469490 --- diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index 51e91047..4cc98689 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -386,7 +386,7 @@ Converter.prototype.toBoolean = function(val, nullable) { }; function _toLong(val) { - var ret = parseInt(val, 10); + var ret = parseInt(val); return isNaN(ret) ? (val === true ? 1 : 0) : ret; }