mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
events: deal with Symbol() passed to event constructor
PR-URL: https://github.com/nodejs/node/pull/33612 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
673f49ac94
commit
3a7a5d7e62
2 files changed
+2
-1
No files matched your search
@@ -50,7 +50,7 @@ class Event {
|
||||
this.#cancelable = !!cancelable;
|
||||
this.#bubbles = !!bubbles;
|
||||
this.#composed = !!composed;
|
||||
this.#type = String(type);
|
||||
this.#type = `${type}`;
|
||||
// isTrusted is special (LegacyUnforgeable)
|
||||
Object.defineProperty(this, 'isTrusted', {
|
||||
get() { return false; },
|
||||
|
||||
@@ -49,6 +49,7 @@ ok(EventTarget);
|
||||
|
||||
ev.preventDefault();
|
||||
strictEqual(ev.defaultPrevented, true);
|
||||
throws(() => new Event(Symbol()), TypeError);
|
||||
}
|
||||
{
|
||||
const ev = new Event('foo');
|
||||
|
||||
Reference in new issue
Block a user