Commit f89db65c authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[DevTools] console.log("%d") should support BigInts

R=luoe@chromium.org
TBR=lushnikov@chromium.org

Bug: v8:7486
Change-Id: I332f979fb91d97c80f08f7dadd47d8929439c3fc
Reviewed-on: https://chromium-review.googlesource.com/1169777Reviewed-by: default avatarAleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: default avatarAlexei Filippov <alph@chromium.org>
Reviewed-by: default avatarErik Luo <luoe@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582276}
parent 87cfb9fb
...@@ -2510,10 +2510,6 @@ crbug.com/543369 [ Win Mac Linux ] fast/forms/select-popup/popup-menu-appearance ...@@ -2510,10 +2510,6 @@ crbug.com/543369 [ Win Mac Linux ] fast/forms/select-popup/popup-menu-appearance
crbug.com/548765 http/tests/devtools/console-fetch-logging.js [ Failure Pass ] crbug.com/548765 http/tests/devtools/console-fetch-logging.js [ Failure Pass ]
# When BigInts are on by default, these should pass and be removed along with their FlagExpectations.
crbug.com/v8/7486 http/tests/devtools/startup/console/console-format-startup-bigint.js [ Skip ]
crbug.com/v8/7486 http/tests/devtools/console/console-format-bigint.js [ Skip ]
crbug.com/564109 [ Win ] http/tests/webfont/font-display-intervention.html [ Pass Failure Timeout ] crbug.com/564109 [ Win ] http/tests/webfont/font-display-intervention.html [ Pass Failure Timeout ]
crbug.com/399951 http/tests/mime/javascript-mimetype-usecounters.html [ Pass Failure ] crbug.com/399951 http/tests/mime/javascript-mimetype-usecounters.html [ Pass Failure ]
......
Tests that console properly displays BigInts.
console-format-bigint.js:15 1n
console-format-bigint.js:16 BigInt {2n}
console-format-bigint.js:17 [1n]
console-format-bigint.js:18 [BigInt]
console-format-bigint.js:19 null 1n BigInt {2n}
Expanded all messages
console-format-bigint.js:15 1n
console-format-bigint.js:16 BigInt {2n}
__proto__: BigInt
[[PrimitiveValue]]: 2n
console-format-bigint.js:17 [1n]
0: 1n
length: 1
__proto__: Array(0)
console-format-bigint.js:18 [BigInt]
0: BigInt {2n}
length: 1
__proto__: Array(0)
console-format-bigint.js:19 null 1n BigInt {2n}
__proto__: BigInt
[[PrimitiveValue]]: 2n
Tests console logging for messages with BigInts that happen before DevTools is open.
console-format-startup-bigint.html:5 1n
console-format-startup-bigint.html:6 BigInt
__proto__: BigInt
[[PrimitiveValue]]: 2n
console-format-startup-bigint.html:7 Array(1)
0: 1n
length: 1
__proto__: Array(0)
console-format-startup-bigint.html:8 Array(1)
0: BigInt {2n}
length: 1
__proto__: Array(0)
console-format-startup-bigint.html:9 null 1n BigInt
__proto__: BigInt
[[PrimitiveValue]]: 2n
...@@ -5,6 +5,7 @@ console-format-bigint.js:16 BigInt {2n} ...@@ -5,6 +5,7 @@ console-format-bigint.js:16 BigInt {2n}
console-format-bigint.js:17 [1n] console-format-bigint.js:17 [1n]
console-format-bigint.js:18 [BigInt] console-format-bigint.js:18 [BigInt]
console-format-bigint.js:19 null 1n BigInt {2n} console-format-bigint.js:19 null 1n BigInt {2n}
console-format-bigint.js:20 123n 123n 123n 123n
Expanded all messages Expanded all messages
console-format-bigint.js:15 1n console-format-bigint.js:15 1n
console-format-bigint.js:16 BigInt {2n} console-format-bigint.js:16 BigInt {2n}
...@@ -21,4 +22,5 @@ console-format-bigint.js:18 [BigInt] ...@@ -21,4 +22,5 @@ console-format-bigint.js:18 [BigInt]
console-format-bigint.js:19 null 1n BigInt {2n} console-format-bigint.js:19 null 1n BigInt {2n}
__proto__: BigInt __proto__: BigInt
[[PrimitiveValue]]: 2n [[PrimitiveValue]]: 2n
console-format-bigint.js:20 123n 123n 123n 123n
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
console.log([1n]); console.log([1n]);
console.log([wrappedBigInt]); console.log([wrappedBigInt]);
console.log(null, 1n, wrappedBigInt); console.log(null, 1n, wrappedBigInt);
console.log('%d %i %d %i', 123n, 123n, BigInt(123), BigInt(123));
`); `);
ConsoleTestRunner.dumpConsoleMessages(false, false, TestRunner.textContentWithLineBreaks); ConsoleTestRunner.dumpConsoleMessages(false, false, TestRunner.textContentWithLineBreaks);
......
...@@ -796,6 +796,8 @@ Console.ConsoleViewMessage = class { ...@@ -796,6 +796,8 @@ Console.ConsoleViewMessage = class {
} }
function integerFormatter(obj) { function integerFormatter(obj) {
if (obj.type === 'bigint')
return obj.description;
if (typeof obj.value !== 'number') if (typeof obj.value !== 'number')
return 'NaN'; return 'NaN';
return Math.floor(obj.value); return Math.floor(obj.value);
......
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