diff options
author | Luca Casonato <hello@lcas.dev> | 2024-05-23 00:03:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-23 00:03:35 +0200 |
commit | 971f09abe486185247e1faf4e8d1419ba2506b8d (patch) | |
tree | 3ed0cf608116ad06e88a87552333e930824cc790 /ext/web/02_event.js | |
parent | 6c167c64d61ecfc912dc1b68d300f02aa3677235 (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 'ext/web/02_event.js')
-rw-r--r-- | ext/web/02_event.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/web/02_event.js b/ext/web/02_event.js index bb7dea42c..510085aac 100644 --- a/ext/web/02_event.js +++ b/ext/web/02_event.js @@ -123,7 +123,7 @@ const _isTrusted = Symbol("[[isTrusted]]"); const _path = Symbol("[[path]]"); class Event { - constructor(type, eventInitDict = {}) { + constructor(type, eventInitDict = { __proto__: null }) { // TODO(lucacasonato): remove when this interface is spec aligned this[SymbolToStringTag] = "Event"; this[_canceledFlag] = false; @@ -1095,7 +1095,7 @@ class ErrorEvent extends Event { lineno = 0, colno = 0, error, - } = {}, + } = { __proto__: null }, ) { super(type, { bubbles: bubbles, @@ -1164,7 +1164,7 @@ class CloseEvent extends Event { wasClean = false, code = 0, reason = "", - } = {}) { + } = { __proto__: null }) { super(type, { bubbles: bubbles, cancelable: cancelable, @@ -1238,7 +1238,7 @@ const MessageEventPrototype = MessageEvent.prototype; class CustomEvent extends Event { #detail = null; - constructor(type, eventInitDict = {}) { + constructor(type, eventInitDict = { __proto__: null }) { super(type, eventInitDict); webidl.requiredArguments( arguments.length, @@ -1280,7 +1280,7 @@ ReflectDefineProperty(CustomEvent.prototype, "detail", { // ProgressEvent could also be used in other DOM progress event emits. // Current use is for FileReader. class ProgressEvent extends Event { - constructor(type, eventInitDict = {}) { + constructor(type, eventInitDict = { __proto__: null }) { super(type, eventInitDict); this.lengthComputable = eventInitDict?.lengthComputable ?? false; @@ -1329,7 +1329,7 @@ class PromiseRejectionEvent extends Event { composed, promise, reason, - } = {}, + } = { __proto__: null }, ) { super(type, { bubbles: bubbles, |