diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index 02ea2b8f0fff48..3fb83aaaac39dd 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, @@ -52,6 +53,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) @@ -67,8 +71,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 });