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 3db37e7

Browse filesBrowse files
aduh95RafaelGSS
authored andcommitted
inspector: refactor inspector/promises to be more robust
Limit the effect of users mutating `node:util`, `node:inspector`, or `Array.prototype`. PR-URL: #45041 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 2e5d8e7 commit 3db37e7
Copy full SHA for 3db37e7

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎lib/inspector/promises.js‎

Copy file name to clipboardExpand all lines: lib/inspector/promises.js
+4-12Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
11
'use strict';
22

33
const inspector = require('inspector');
4-
const { promisify } = require('util');
5-
const { FunctionPrototypeBind } = primordials;
4+
const { promisify } = require('internal/util');
5+
66
class Session extends inspector.Session {
7-
#post = promisify(FunctionPrototypeBind(super.post, this));
8-
/**
9-
* Posts a message to the inspector back-end.
10-
* @param {string} method
11-
* @param {Record<unknown, unknown>} [params]
12-
* @returns {Promise}
13-
*/
14-
async post(method, params) {
15-
return this.#post(method, params);
16-
}
7+
constructor() { super(); } // eslint-disable-line no-useless-constructor
178
}
9+
Session.prototype.post = promisify(inspector.Session.prototype.post);
1810

1911
module.exports = {
2012
...inspector,

0 commit comments

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