mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
src: accept single argument in getProxyDetails
This makes sure this function stays backwards compatible in case it's accessed through the binding directly. Refs: https://github.com/nodejs/node/pull/29947#issuecomment-562987888 Backport-PR-URL: https://github.com/nodejs/node/pull/31431 PR-URL: https://github.com/nodejs/node/pull/30858 Refs: https://github.com/nodejs/node/pull/30767 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
d3c0f46054
commit
7a855f57b8
2 files changed
+8
-3
No files matched your search
+4
-3
@@ -91,11 +91,12 @@ static void GetProxyDetails(const FunctionCallbackInfo<Value>& args) {
|
||||
if (!args[0]->IsProxy())
|
||||
return;
|
||||
|
||||
CHECK(args[1]->IsBoolean());
|
||||
|
||||
Local<Proxy> proxy = args[0].As<Proxy>();
|
||||
|
||||
if (args[1]->IsTrue()) {
|
||||
// TODO(BridgeAR): Remove the length check as soon as we prohibit access to
|
||||
// the util binding layer. It's accessed in the wild and `esm` would break in
|
||||
// case the check is removed.
|
||||
if (args.Length() == 1 || args[1]->IsTrue()) {
|
||||
Local<Value> ret[] = {
|
||||
proxy->GetTarget(),
|
||||
proxy->GetHandler()
|
||||
|
||||
@@ -50,6 +50,10 @@ let details = processUtil.getProxyDetails(proxyObj, true);
|
||||
assert.strictEqual(target, details[0]);
|
||||
assert.strictEqual(handler, details[1]);
|
||||
|
||||
details = processUtil.getProxyDetails(proxyObj);
|
||||
assert.strictEqual(target, details[0]);
|
||||
assert.strictEqual(handler, details[1]);
|
||||
|
||||
details = processUtil.getProxyDetails(proxyObj, false);
|
||||
assert.strictEqual(target, details);
|
||||
|
||||
|
||||
Reference in new issue
Block a user