Protecting better against undefined properties

This commit is contained in:
metacryst
2024-04-01 15:14:14 -05:00
parent bf3650ef6a
commit 6a33126563
5 changed files with 82 additions and 21 deletions

View File

@@ -171,6 +171,25 @@ window.testSuites.push( class testInit {
}
}
CannotAddUndefinedPropertiesAfterDefaultConstructor() {
register(class File extends Shadow {
render = () => {
p("boi")
}
}, randomName("file"))
try {
const file = File()
file.hey = "unallowed"
return "Did not throw error!"
} catch(e) {
if(!e.message.includes("extensible")) {
throw e
}
}
}
NonStateFieldsGetSet() {
register(class File extends Shadow {
nonStateField