Skip to content

Commit

Permalink
events: deal with Symbol() passed to event constructor
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
Benjamin Gruenbaum authored and codebytere committed Jun 18, 2020
1 parent 21f1e64 commit e7bce2e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; },
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-eventtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ok(EventTarget);

ev.preventDefault();
strictEqual(ev.defaultPrevented, true);
throws(() => new Event(Symbol()), TypeError);
}
{
const ev = new Event('foo');
Expand Down

0 comments on commit e7bce2e

Please sign in to comment.