Skip to content

Commit

Permalink
bootstrap: use correct descriptor for Symbol.{dispose,asyncDispose}
Browse files Browse the repository at this point in the history
Followup to nodejs#48518; fixes nodejs#48699

PR-URL: nodejs#48703
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
ljharb authored and Ceres6 committed Aug 14, 2023
1 parent 2ed1b28 commit 8396660
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions lib/internal/process/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,26 @@ function prepareExecution(options) {
function setupSymbolDisposePolyfill() {
// TODO(MoLow): Remove this polyfill once Symbol.dispose and Symbol.asyncDispose are available in V8.
// eslint-disable-next-line node-core/prefer-primordials
Symbol.dispose ??= SymbolDispose;
if (typeof Symbol.dispose !== 'symbol') {
ObjectDefineProperty(Symbol, 'dispose', {
__proto__: null,
configurable: false,
enumerable: false,
value: SymbolDispose,
writable: false,
});
}

// eslint-disable-next-line node-core/prefer-primordials
Symbol.asyncDispose ??= SymbolAsyncDispose;
if (typeof Symbol.asyncDispose !== 'symbol') {
ObjectDefineProperty(Symbol, 'asyncDispose', {
__proto__: null,
configurable: false,
enumerable: false,
value: SymbolAsyncDispose,
writable: false,
});
}
}

function setupUserModules(isLoaderWorker = false) {
Expand Down

0 comments on commit 8396660

Please sign in to comment.