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 202f007

Browse filesBrowse files
benglMylesBorins
authored andcommitted
process: maintain constructor descriptor
Use the original property descriptor instead of just taking the value, which would, by default, be non-writable and non-configurable. PR-URL: #9306 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 331681a commit 202f007
Copy full SHA for 202f007

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

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

‎lib/internal/bootstrap_node.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap_node.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
const EventEmitter = NativeModule.require('events');
1414
process._eventsCount = 0;
1515

16+
const origProcProto = Object.getPrototypeOf(process);
1617
Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, {
17-
constructor: {
18-
value: process.constructor
19-
}
18+
constructor: Object.getOwnPropertyDescriptor(origProcProto, 'constructor')
2019
}));
2120

2221
EventEmitter.call(process);
Collapse file
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
const EventEmitter = require('events');
5+
6+
const proto = Object.getPrototypeOf(process);
7+
8+
assert(proto instanceof EventEmitter);
9+
10+
const desc = Object.getOwnPropertyDescriptor(proto, 'constructor');
11+
12+
assert.strictEqual(desc.value, process.constructor);
13+
assert.strictEqual(desc.writable, true);
14+
assert.strictEqual(desc.enumerable, false);
15+
assert.strictEqual(desc.configurable, true);

0 commit comments

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