summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Berlette <nick@berlette.com>2023-06-28 18:46:30 -0700
committerGitHub <noreply@github.com>2023-06-28 19:46:30 -0600
commitb6253370cc8e430c575acd3fce0da44e057eb5b9 (patch)
treec7e550ffcd3e664e650292784401bfe45f21d3fe /ext
parent0434e041778cb3803de901b841f18b8fd8cc2a67 (diff)
fix(console): correct the parseCssColor algorithm (#19645)
This is a fix for issue #19644, concerning the `parseCssColor` function in the file `ext/console/01_console.js`. Changes made on lines 2756-2758. To sum it up: > The internal `parseCssColor` function currently parses 3/4-digit hex colors incorrectly. For example, it parses the string `#FFFFFF` as `[255, 255, 255]` (as expected), but returns `[240, 240, 240]` for `#FFF`, when it should return the same triplet as the former. While it's not going to cause a fatal runtime error, it did bug me enough to fix it real quick.
Diffstat (limited to 'ext')
-rw-r--r--ext/console/01_console.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js
index d5ed80a63..8d9c56c92 100644
--- a/ext/console/01_console.js
+++ b/ext/console/01_console.js
@@ -2541,7 +2541,7 @@ function replaceEscapeSequences(string) {
ESCAPE_PATTERN,
(c) => ESCAPE_MAP[c],
),
- new SafeRegExp(ESCAPE_PATTERN2),
+ ESCAPE_PATTERN2,
(c) =>
"\\x" +
StringPrototypePadStart(
@@ -2753,9 +2753,9 @@ function parseCssColor(colorString) {
const smallHashMatch = StringPrototypeMatch(colorString, SMALL_HASH_PATTERN);
if (smallHashMatch != null) {
return [
- Number(`0x${smallHashMatch[1]}0`),
- Number(`0x${smallHashMatch[2]}0`),
- Number(`0x${smallHashMatch[3]}0`),
+ Number(`0x${smallHashMatch[1]}${smallHashMatch[1]}`),
+ Number(`0x${smallHashMatch[2]}${smallHashMatch[2]}`),
+ Number(`0x${smallHashMatch[3]}${smallHashMatch[3]}`),
];
}
// deno-fmt-ignore
@@ -3329,7 +3329,7 @@ class Console {
if (properties !== undefined && !ArrayIsArray(properties)) {
throw new Error(
"The 'properties' argument must be of type Array. " +
- "Received type string",
+ "Received type " + typeof properties,
);
}
@@ -3436,7 +3436,7 @@ class Console {
label = String(label);
if (!MapPrototypeHas(timerMap, label)) {
- this.warn(`Timer '${label}' does not exists`);
+ this.warn(`Timer '${label}' does not exist`);
return;
}