diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index a55c9e461de458..a2a6452a3fcf60 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -7,6 +7,7 @@ const { Map, NumberIsInteger, Object, + ObjectDefineProperty, Symbol, SymbolFor, SymbolToStringTag, @@ -57,6 +58,9 @@ const kTimestamp = Symbol('timestamp'); const kBubbles = Symbol('bubbles'); const kComposed = Symbol('composed'); const kPropagationStopped = Symbol('propagationStopped'); + +const isTrusted = () => false; + class Event { constructor(type, options) { if (arguments.length === 0) @@ -72,8 +76,8 @@ class Event { this[kTimestamp] = lazyNow(); this[kPropagationStopped] = false; // isTrusted is special (LegacyUnforgeable) - Object.defineProperty(this, 'isTrusted', { - get() { return false; }, + ObjectDefineProperty(this, 'isTrusted', { + get: isTrusted, enumerable: true, configurable: false });