From e60bd1a7dc5e51c08f9fc188558e5532602ac2bd 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 Backport-PR-URL: https://github.com/nodejs/node/pull/37832 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 | 6 +++++- test/wpt/status/hr-time.json | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 6a759bbbf4e2d6..474cdadc772983 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -54,6 +54,9 @@ const { NODE_PERFORMANCE_MILESTONE_ENVIRONMENT } = constants; +const { + EventTarget, +} = require('internal/event_target'); const L = require('internal/linkedlist'); const kInspect = require('internal/util').customInspectSymbol; @@ -418,8 +421,9 @@ class PerformanceObserver { } } -class Performance { +class Performance extends EventTarget { constructor() { + super(); this[kIndex] = { [kMarks]: new SafeSet() }; 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" },