Skip to content

Commit

Permalink
perf_hooks: make Performance extend EventTarget
Browse files Browse the repository at this point in the history
Refs: https://www.w3.org/TR/hr-time/#sec-performance

PR-URL: #37621
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
targos committed Mar 8, 2021
1 parent f44f021 commit 5d4fc63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 6 additions & 2 deletions lib/perf_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ const {
constants,
} = internalBinding('performance');

const {
EventTarget,
} = require('internal/event_target');

const {
PerformanceEntry,
now,
Expand All @@ -36,7 +40,7 @@ const timerify = require('internal/perf/timerify');
const { customInspectSymbol: kInspect } = require('internal/util');
const { inspect } = require('util');

class Performance {
class Performance extends EventTarget {
constructor() {
// eslint-disable-next-line no-restricted-syntax
throw new TypeError('Illegal constructor');
Expand All @@ -57,7 +61,7 @@ class Performance {
}
}

class InternalPerformance {}
class InternalPerformance extends EventTarget {}
InternalPerformance.prototype.constructor = Performance.prototype.constructor;
ObjectSetPrototypeOf(InternalPerformance.prototype, Performance.prototype);

Expand Down
3 changes: 0 additions & 3 deletions test/wpt/status/hr-time.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
{
"basic.any.js": {
"fail": "self.performance.addEventListener is not a function"
},
"idlharness.any.js": {
"skip": "TODO: update IDL parser"
},
Expand Down

0 comments on commit 5d4fc63

Please sign in to comment.