diff options
author | Gus Caplan <me@gus.host> | 2018-04-30 19:44:41 -0500 |
---|---|---|
committer | Gus Caplan <me@gus.host> | 2018-05-03 13:41:49 -0500 |
commit | a59826403a76fcc7a6685a52ee82d19be323a699 (patch) | |
tree | 1209c6c5e26f20392811fbbd505755bb231dfaa8 /lib/console.js | |
parent | 0930d7ec05d8a0d29d7562f881ca67a959ec18a4 (diff) | |
download | node-new-a59826403a76fcc7a6685a52ee82d19be323a699.tar.gz |
console: console.time() should not reset a timer when it exists
PR-URL: https://github.com/nodejs/node/pull/20442
Fixes: https://github.com/nodejs/node/issues/20440
Refs: https://console.spec.whatwg.org/#time
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'lib/console.js')
-rw-r--r-- | lib/console.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/console.js b/lib/console.js index a0158ec664..07f177d595 100644 --- a/lib/console.js +++ b/lib/console.js @@ -225,6 +225,10 @@ Console.prototype.dir = function dir(object, options) { Console.prototype.time = function time(label = 'default') { // Coerces everything other than Symbol to a string label = `${label}`; + if (this._times.has(label)) { + process.emitWarning(`Label '${label}' already exists for console.time()`); + return; + } this._times.set(label, process.hrtime()); }; |