| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 63045bf commit c4ff510
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -759,6 +759,9 @@ function formatValue(ctx, value, recurseTimes, typedArray) { | |||
| 759 | 759 | // any proxy handlers. | |
| 760 | 760 | const proxy = getProxyDetails(value, !!ctx.showProxy); | |
| 761 | 761 | if (proxy !== undefined) { | |
| 762 | + if (proxy === null || proxy[0] === null) { | ||
| 763 | + return ctx.stylize('<Revoked Proxy>', 'special'); | ||
| 764 | + } | ||
| 762 | 765 | if (ctx.showProxy) { | |
| 763 | 766 | return formatProxy(ctx, proxy, recurseTimes); | |
| 764 | 767 | } | |
@@ -1967,6 +1970,9 @@ function hasBuiltInToString(value) { | |||
| 1967 | 1970 | const getFullProxy = false; | |
| 1968 | 1971 | const proxyTarget = getProxyDetails(value, getFullProxy); | |
| 1969 | 1972 | if (proxyTarget !== undefined) { | |
| 1973 | + if (proxyTarget === null) { | ||
| 1974 | + return true; | ||
| 1975 | + } | ||
| 1970 | 1976 | value = proxyTarget; | |
| 1971 | 1977 | } | |
| 1972 | 1978 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,12 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + require('../common'); | ||
| 4 | + const { inspect } = require('node:util'); | ||
| 5 | + | ||
| 6 | + const r = Proxy.revocable({}, {}); | ||
| 7 | + r.revoke(); | ||
| 8 | + | ||
| 9 | + console.dir(r); | ||
| 10 | + console.dir(r.proxy); | ||
| 11 | + console.log(r.proxy); | ||
| 12 | + console.log(inspect(r.proxy, { showProxy: true })); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,6 +57,27 @@ assert.strictEqual(handler, details[1]); | |||
| 57 | 57 | details = processUtil.getProxyDetails(proxyObj, false); | |
| 58 | 58 | assert.strictEqual(target, details); | |
| 59 | 59 | ||
| 60 | + details = processUtil.getProxyDetails({}, true); | ||
| 61 | + assert.strictEqual(details, undefined); | ||
| 62 | + | ||
| 63 | + const r = Proxy.revocable({}, {}); | ||
| 64 | + r.revoke(); | ||
| 65 | + | ||
| 66 | + details = processUtil.getProxyDetails(r.proxy, true); | ||
| 67 | + assert.strictEqual(details[0], null); | ||
| 68 | + assert.strictEqual(details[1], null); | ||
| 69 | + | ||
| 70 | + details = processUtil.getProxyDetails(r.proxy, false); | ||
| 71 | + assert.strictEqual(details, null); | ||
| 72 | + | ||
| 73 | + assert.strictEqual(util.inspect(r.proxy), '<Revoked Proxy>'); | ||
| 74 | + assert.strictEqual( | ||
| 75 | + util.inspect(r, { showProxy: true }), | ||
| 76 | + '{ proxy: <Revoked Proxy>, revoke: [Function (anonymous)] }', | ||
| 77 | + ); | ||
| 78 | + | ||
| 79 | + assert.strictEqual(util.format('%s', r.proxy), '<Revoked Proxy>'); | ||
| 80 | + | ||
| 60 | 81 | assert.strictEqual( | |
| 61 | 82 | util.inspect(proxyObj, opts), | |
| 62 | 83 | 'Proxy [\n' + | |
| Back | FazBrowse Home | New Git URL |
0 commit comments