summaryrefslogtreecommitdiff
path: root/tests/unit/event_test.ts
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2024-05-23 00:03:35 +0200
committerGitHub <noreply@github.com>2024-05-23 00:03:35 +0200
commit971f09abe486185247e1faf4e8d1419ba2506b8d (patch)
tree3ed0cf608116ad06e88a87552333e930824cc790 /tests/unit/event_test.ts
parent6c167c64d61ecfc912dc1b68d300f02aa3677235 (diff)
fix(runtime): use more null proto objects (#23921)
This is a primordialization effort to improve resistance against users tampering with the global `Object` prototype. --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'tests/unit/event_test.ts')
-rw-r--r--tests/unit/event_test.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/event_test.ts b/tests/unit/event_test.ts
index c82873cf6..bd398fd41 100644
--- a/tests/unit/event_test.ts
+++ b/tests/unit/event_test.ts
@@ -141,3 +141,17 @@ Deno.test(function inspectEvent() {
`Event {\n bubbles: false,\n cancelable: false,`,
);
});
+
+Deno.test("default argument is null prototype", () => {
+ const event = new Event("test");
+ assertEquals(event.bubbles, false);
+
+ // @ts-ignore this is on purpose to check if overriding prototype
+ // has effect on `Event.
+ Object.prototype.bubbles = true;
+ const event2 = new Event("test");
+ assertEquals(event2.bubbles, false);
+
+ // @ts-ignore this is done on purpose
+ delete Object.prototype.bubbles;
+});