summaryrefslogtreecommitdiff
path: root/ext/console/02_console.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/console/02_console.js')
-rw-r--r--ext/console/02_console.js29
1 files changed, 19 insertions, 10 deletions
diff --git a/ext/console/02_console.js b/ext/console/02_console.js
index 9a9ead5a1..3cfa12d1f 100644
--- a/ext/console/02_console.js
+++ b/ext/console/02_console.js
@@ -56,6 +56,7 @@
RegExpPrototypeTest,
RegExpPrototypeToString,
SafeArrayIterator,
+ SafeStringIterator,
SafeSet,
SetPrototype,
SetPrototypeEntries,
@@ -206,7 +207,7 @@
str = StringPrototypeNormalize(colors.stripColor(str), "NFC");
let width = 0;
- for (const ch of str) {
+ for (const ch of new SafeStringIterator(str)) {
width += isFullWidthCodePoint(StringPrototypeCodePointAt(ch, 0)) ? 2 : 1;
}
@@ -276,7 +277,7 @@
}` +
`${tableChars.rightMiddle}\n`;
- for (const row of rows) {
+ for (const row of new SafeArrayIterator(rows)) {
result += `${renderRow(row, columnWidths, columnRightAlign)}\n`;
}
@@ -994,7 +995,7 @@
}
const refMap = new Map();
- for (const cause of causes) {
+ for (const cause of new SafeArrayIterator(causes)) {
if (circular !== undefined) {
const index = MapPrototypeGet(circular, cause);
if (index !== undefined) {
@@ -1171,7 +1172,7 @@
inspectOptions.indentLevel++;
- for (const key of stringKeys) {
+ for (const key of new SafeArrayIterator(stringKeys)) {
if (inspectOptions.getters) {
let propertyValue;
let error = null;
@@ -1207,7 +1208,7 @@
}
}
- for (const key of symbolKeys) {
+ for (const key of new SafeArrayIterator(symbolKeys)) {
if (
!inspectOptions.showHidden &&
!propertyIsEnumerable(value, key)
@@ -1639,7 +1640,7 @@
currentPart = "";
}
- for (const [key, value] of rawEntries) {
+ for (const [key, value] of new SafeArrayIterator(rawEntries)) {
if (key == "background-color") {
if (value != null) {
css.backgroundColor = value;
@@ -1660,7 +1661,11 @@
}
} else if (key == "text-decoration-line") {
css.textDecorationLine = [];
- for (const lineType of StringPrototypeSplit(value, /\s+/g)) {
+ for (
+ const lineType of new SafeArrayIterator(
+ StringPrototypeSplit(value, /\s+/g),
+ )
+ ) {
if (
ArrayPrototypeIncludes(
["line-through", "overline", "underline"],
@@ -1678,7 +1683,11 @@
} else if (key == "text-decoration") {
css.textDecorationColor = null;
css.textDecorationLine = [];
- for (const arg of StringPrototypeSplit(value, /\s+/g)) {
+ for (
+ const arg of new SafeArrayIterator(
+ StringPrototypeSplit(value, /\s+/g),
+ )
+ ) {
const maybeColor = parseCssColor(arg);
if (maybeColor != null) {
css.textDecorationColor = maybeColor;
@@ -2135,7 +2144,7 @@
} else {
const valueObj = value || {};
const keys = properties || ObjectKeys(valueObj);
- for (const k of keys) {
+ for (const k of new SafeArrayIterator(keys)) {
if (!primitive && ReflectHas(valueObj, k)) {
if (!(ReflectHas(objectValues, k))) {
objectValues[k] = ArrayPrototypeFill(new Array(numRows), "");
@@ -2330,7 +2339,7 @@
function wrapConsole(consoleFromDeno, consoleFromV8) {
const callConsole = core.callConsole;
- for (const key of ObjectKeys(consoleFromV8)) {
+ for (const key of new SafeArrayIterator(ObjectKeys(consoleFromV8))) {
if (ObjectPrototypeHasOwnProperty(consoleFromDeno, key)) {
consoleFromDeno[key] = FunctionPrototypeBind(
callConsole,