summaryrefslogtreecommitdiff
path: root/extensions/timers/02_performance.js
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2021-07-08 09:43:36 -0400
committerGitHub <noreply@github.com>2021-07-08 09:43:36 -0400
commit5fa58c92165e23386b8ed3c3079103997fe1bef9 (patch)
treed7efc34a11322d10f2749b5083cd84fa1b4a18d6 /extensions/timers/02_performance.js
parent5e092b19fe113bdecd36b4e0184c82f4b3343bca (diff)
fix: inspecting prototypes of built-ins with custom inspect implementations should not throw (#11308)
Diffstat (limited to 'extensions/timers/02_performance.js')
-rw-r--r--extensions/timers/02_performance.js42
1 files changed, 38 insertions, 4 deletions
diff --git a/extensions/timers/02_performance.js b/extensions/timers/02_performance.js
index b4cf5760b..f752ba933 100644
--- a/extensions/timers/02_performance.js
+++ b/extensions/timers/02_performance.js
@@ -16,6 +16,7 @@
} = window.__bootstrap.primordials;
const { webidl, structuredClone } = window.__bootstrap;
+ const consoleInternal = window.__bootstrap.console;
const { opNow } = window.__bootstrap.timers;
const { DOMException } = window.__bootstrap.domException;
@@ -175,7 +176,16 @@
}
[customInspect](inspect) {
- return `${this.constructor.name} ${inspect(this.toJSON())}`;
+ return inspect(consoleInternal.createFilteredInspectProxy({
+ object: this,
+ evaluate: this instanceof PerformanceEntry,
+ keys: [
+ "name",
+ "entryType",
+ "startTime",
+ "duration",
+ ],
+ }));
}
}
webidl.configurePrototype(PerformanceEntry);
@@ -235,7 +245,17 @@
}
[customInspect](inspect) {
- return `${this.constructor.name} ${inspect(this.toJSON())}`;
+ return inspect(consoleInternal.createFilteredInspectProxy({
+ object: this,
+ evaluate: this instanceof PerformanceMark,
+ keys: [
+ "name",
+ "entryType",
+ "startTime",
+ "duration",
+ "detail",
+ ],
+ }));
}
}
webidl.configurePrototype(PerformanceMark);
@@ -283,7 +303,17 @@
}
[customInspect](inspect) {
- return `${this.constructor.name} ${inspect(this.toJSON())}`;
+ return inspect(consoleInternal.createFilteredInspectProxy({
+ object: this,
+ evaluate: this instanceof PerformanceMeasure,
+ keys: [
+ "name",
+ "entryType",
+ "startTime",
+ "duration",
+ "detail",
+ ],
+ }));
}
}
webidl.configurePrototype(PerformanceMeasure);
@@ -516,7 +546,11 @@
}
[customInspect](inspect) {
- return `${this.constructor.name} ${inspect(this.toJSON())}`;
+ return inspect(consoleInternal.createFilteredInspectProxy({
+ object: this,
+ evaluate: this instanceof Performance,
+ keys: [],
+ }));
}
get [SymbolToStringTag]() {