diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-07-08 09:43:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 09:43:36 -0400 |
commit | 5fa58c92165e23386b8ed3c3079103997fe1bef9 (patch) | |
tree | d7efc34a11322d10f2749b5083cd84fa1b4a18d6 /extensions/fetch/23_response.js | |
parent | 5e092b19fe113bdecd36b4e0184c82f4b3343bca (diff) |
fix: inspecting prototypes of built-ins with custom inspect implementations should not throw (#11308)
Diffstat (limited to 'extensions/fetch/23_response.js')
-rw-r--r-- | extensions/fetch/23_response.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/extensions/fetch/23_response.js b/extensions/fetch/23_response.js index 11eb13570..0db20e90e 100644 --- a/extensions/fetch/23_response.js +++ b/extensions/fetch/23_response.js @@ -13,6 +13,7 @@ ((window) => { const webidl = window.__bootstrap.webidl; + const consoleInternal = window.__bootstrap.console; const { HTTP_TAB_OR_SPACE, regexMatcher } = window.__bootstrap.infra; const { extractBody, mixinBody } = window.__bootstrap.fetchBody; const { getLocationHref } = window.__bootstrap.location; @@ -377,17 +378,20 @@ } [SymbolFor("Deno.customInspect")](inspect) { - const inner = { - body: this.body, - bodyUsed: this.bodyUsed, - headers: this.headers, - ok: this.ok, - redirected: this.redirected, - status: this.status, - statusText: this.statusText, - url: this.url, - }; - return `Response ${inspect(inner)}`; + return inspect(consoleInternal.createFilteredInspectProxy({ + object: this, + evaluate: this instanceof Response, + keys: [ + "body", + "bodyUsed", + "headers", + "ok", + "redirected", + "status", + "statusText", + "url", + ], + })); } } |