From 5d4fc63eb8931b8b4c8e0d3262f84b3f235a3b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 6 Mar 2021 10:07:54 +0100 Subject: [PATCH] perf_hooks: make Performance extend EventTarget Refs: https://www.w3.org/TR/hr-time/#sec-performance PR-URL: https://github.com/nodejs/node/pull/37621 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Antoine du Hamel Reviewed-By: Darshan Sen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- lib/perf_hooks.js | 8 ++++++-- test/wpt/status/hr-time.json | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 1c183f1a1f2865..1f9a665a3ca006 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -12,6 +12,10 @@ const { constants, } = internalBinding('performance'); +const { + EventTarget, +} = require('internal/event_target'); + const { PerformanceEntry, now, @@ -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'); @@ -57,7 +61,7 @@ class Performance { } } -class InternalPerformance {} +class InternalPerformance extends EventTarget {} InternalPerformance.prototype.constructor = Performance.prototype.constructor; ObjectSetPrototypeOf(InternalPerformance.prototype, Performance.prototype); diff --git a/test/wpt/status/hr-time.json b/test/wpt/status/hr-time.json index 4910d925b5be94..cb9f26a2ebca7e 100644 --- a/test/wpt/status/hr-time.json +++ b/test/wpt/status/hr-time.json @@ -1,7 +1,4 @@ { - "basic.any.js": { - "fail": "self.performance.addEventListener is not a function" - }, "idlharness.any.js": { "skip": "TODO: update IDL parser" },