[Utils] Fix Long conversion (allow hex string value) 33/167433/2
authorJakub Skowron <j.skowron@samsung.com>
Wed, 17 Jan 2018 13:27:09 +0000 (14:27 +0100)
committerJakub Skowron <j.skowron@samsung.com>
Fri, 26 Jan 2018 08:25:49 +0000 (08:25 +0000)
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

src/utils/utils_api.js

index 51e9104..4cc9868 100644 (file)
@@ -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;
 }