Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 397ae41

Browse filesBrowse files
ljharbtargos
authored andcommitted
lib: the REPL should survive deletion of Array.prototype methods
Specifically, `delete Array.prototype.lastIndexOf` immediately crashes the REPL, as does deletion of a few other Array prototype methods. PR-URL: #31457 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent f2d74a2 commit 397ae41
Copy full SHA for 397ae41

File tree

Expand file treeCollapse file tree

2 files changed

+4
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-3
lines changed
Open diff view settings
Collapse file

‎lib/domain.js‎

Copy file name to clipboardExpand all lines: lib/domain.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const {
4040
ReflectApply,
4141
SafeMap,
4242
SafeWeakMap,
43+
StringPrototypeRepeat,
4344
Symbol,
4445
} = primordials;
4546

@@ -131,7 +132,7 @@ const domainRequireStack = new Error('require(`domain`) at this point').stack;
131132
const { setUncaughtExceptionCaptureCallback } = process;
132133
process.setUncaughtExceptionCaptureCallback = function(fn) {
133134
const err = new ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE();
134-
err.stack = err.stack + '\n' + '-'.repeat(40) + '\n' + domainRequireStack;
135+
err.stack += `\n${StringPrototypeRepeat('-', 40)}\n${domainRequireStack}`;
135136
throw err;
136137
};
137138

Collapse file

‎lib/repl.js‎

Copy file name to clipboardExpand all lines: lib/repl.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,15 +1528,15 @@ function complete(line, callback) {
15281528
let p;
15291529
if ((typeof obj === 'object' && obj !== null) ||
15301530
typeof obj === 'function') {
1531-
memberGroups.push(filteredOwnPropertyNames(obj));
1531+
ArrayPrototypePush(memberGroups, filteredOwnPropertyNames(obj));
15321532
p = ObjectGetPrototypeOf(obj);
15331533
} else {
15341534
p = obj.constructor ? obj.constructor.prototype : null;
15351535
}
15361536
// Circular refs possible? Let's guard against that.
15371537
let sentinel = 5;
15381538
while (p !== null && sentinel-- !== 0) {
1539-
memberGroups.push(filteredOwnPropertyNames(p));
1539+
ArrayPrototypePush(memberGroups, filteredOwnPropertyNames(p));
15401540
p = ObjectGetPrototypeOf(p);
15411541
}
15421542
} catch {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.