1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibWeb: Exclude [Global] interfaces from legacy platform object method

Previously, [Global] interfaces were not excluded from the
`internal_own_property_keys()` call. This caused a crash when iterating
over the properties of the Window object.
This commit is contained in:
Tim Ledbetter 2024-04-04 12:40:59 +01:00 committed by Andreas Kling
parent ff9ae5ff40
commit dda730c46b
Notes: sideshowbarker 2024-07-17 01:13:25 +09:00
3 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1 @@
PASS (didn't crash)

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<script src="../include.js"></script>
<div id="global-variable"></div>
<script>
test(() => {
for (const property in window) {
}
println("PASS (didn't crash)");
});
</script>

View file

@ -414,7 +414,7 @@ JS::ThrowCompletionOr<bool> PlatformObject::internal_prevent_extensions()
// https://webidl.spec.whatwg.org/#legacy-platform-object-ownpropertykeys
JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> PlatformObject::internal_own_property_keys() const
{
if (!m_legacy_platform_object_flags.has_value())
if (!m_legacy_platform_object_flags.has_value() || m_legacy_platform_object_flags->has_global_interface_extended_attribute)
return Base::internal_own_property_keys();
auto& vm = this->vm();