Commit 8e575f12 authored by qiankun.miao's avatar qiankun.miao Committed by Commit bot

Handle integer -0 as 0 in extensions

-0 is treated as double 0.0f in V8. This makes GetAsInteger()
return -0 is not an integer type. Extension APIs with integer parameters
will fail to get the value using GetAsInteger(). This CL convert integer
-0 to integer 0.

BUG=471011

Review URL: https://codereview.chromium.org/1126983009

Cr-Commit-Position: refs/heads/master@{#329860}
parent 648fb54e
......@@ -118,6 +118,9 @@ function normalizeArgumentsAndValidate(args, funDef) {
var normalizedArgs = [];
var ai = 0;
for (var si = 0; si < definedSignature.length; si++) {
// Handle integer -0 as 0.
if (JSONSchemaValidator.getType(args[ai]) === "integer" && args[ai] === 0)
args[ai] = 0;
if (definedSignature[si] === resolvedSignature[ai])
$Array.push(normalizedArgs, args[ai++]);
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment