diff options
author | 迷渡 <justjavac@gmail.com> | 2019-04-19 09:56:33 +0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-04-18 21:56:33 -0400 |
commit | d0cd7a39a2d05343c5501dc286bb59096659654f (patch) | |
tree | adffb215b15e8ca3411db732f5604158e5ab9640 /js/event_target_test.ts | |
parent | 2be7e4440339f616a37b9535cc38936f80efc0e1 (diff) |
avoid prototype builtin hasOwnProperty (#2144)
Diffstat (limited to 'js/event_target_test.ts')
-rw-r--r-- | js/event_target_test.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/event_target_test.ts b/js/event_target_test.ts index 71c872dab..aedbbf72a 100644 --- a/js/event_target_test.ts +++ b/js/event_target_test.ts @@ -92,3 +92,21 @@ test(function toStringShouldBeWebCompatibility() { const target = new EventTarget(); assertEquals(target.toString(), "[object EventTarget]"); }); + +test(function dispatchEventShouldNotThrowError() { + let hasThrown = false; + + try { + const target = new EventTarget(); + const event = new Event("hasOwnProperty", { + bubbles: true, + cancelable: false + }); + target.addEventListener("hasOwnProperty", () => {}); + target.dispatchEvent(event); + } catch { + hasThrown = true; + } + + assertEquals(hasThrown, false); +}); |