mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-25 20:42:55 +00:00
LibJS: Do not coerce nullish references to unresolvable references
These are not strictly unresolvable references. Treating them as such fails an assertion in the `delete UnaryExpression` semantic (which is Reference::delete_ in our implementation) - we enter the unresolvable, branch, which then asserts that the [[Strict]] slot of the reference is false.
This commit is contained in:
parent
f57310999d
commit
2b19d1b5ab
Notes:
sideshowbarker
2024-07-17 07:43:05 +09:00
Author: https://github.com/trflynn89
Commit: 2b19d1b5ab
Pull-request: https://github.com/SerenityOS/serenity/pull/19852
2 changed files with 11 additions and 6 deletions
|
@ -87,6 +87,12 @@ test("deleting super property", () => {
|
|||
}
|
||||
}
|
||||
|
||||
class C {
|
||||
static foo() {
|
||||
delete super.bar;
|
||||
}
|
||||
}
|
||||
|
||||
const obj = new B();
|
||||
expect(() => {
|
||||
obj.bar();
|
||||
|
@ -95,6 +101,11 @@ test("deleting super property", () => {
|
|||
expect(() => {
|
||||
obj.baz();
|
||||
}).toThrowWithMessage(ReferenceError, "Can't delete a property on 'super'");
|
||||
|
||||
Object.setPrototypeOf(C, null);
|
||||
expect(() => {
|
||||
C.foo();
|
||||
}).toThrowWithMessage(ReferenceError, "Can't delete a property on 'super'");
|
||||
});
|
||||
|
||||
test("deleting an object computed property coerces the object to a property key", () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue