-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: do not check circular dependencies for exported proxies
In case the exported module is a proxy that has the `getPrototypeOf` or `setPrototypeOf` trap, skip the circular dependencies check. It would otherwise be triggered by the check itself. Fixes: #33334 Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de> PR-URL: #33338 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com>
- Loading branch information
Showing
4 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = new Proxy({}, { | ||
get(_target, prop) { throw new Error(`get: ${String(prop)}`); }, | ||
getPrototypeOf() { throw new Error('getPrototypeOf'); }, | ||
setPrototypeOf() { throw new Error('setPrototypeOf'); }, | ||
isExtensible() { throw new Error('isExtensible'); }, | ||
preventExtensions() { throw new Error('preventExtensions'); }, | ||
getOwnPropertyDescriptor() { throw new Error('getOwnPropertyDescriptor'); }, | ||
defineProperty() { throw new Error('defineProperty'); }, | ||
has() { throw new Error('has'); }, | ||
set() { throw new Error('set'); }, | ||
deleteProperty() { throw new Error('deleteProperty'); }, | ||
ownKeys() { throw new Error('ownKeys'); }, | ||
apply() { throw new Error('apply'); }, | ||
construct() { throw new Error('construct'); } | ||
}); | ||
|
||
require('./warning-skip-proxy-traps-b.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const assert = require('assert'); | ||
|
||
const object = require('./warning-skip-proxy-traps-a.js'); | ||
|
||
assert.throws(() => { | ||
object.missingPropProxyTrap; | ||
}, { | ||
message: 'get: missingPropProxyTrap', | ||
name: 'Error', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters