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:
parent
ff9ae5ff40
commit
dda730c46b
Notes:
sideshowbarker
2024-07-17 01:13:25 +09:00
Author: https://github.com/tcl3
Commit: dda730c46b
Pull-request: https://github.com/SerenityOS/serenity/pull/23835
Issue: https://github.com/SerenityOS/serenity/issues/22973
3 changed files with 12 additions and 1 deletions
|
@ -0,0 +1 @@
|
|||
PASS (didn't crash)
|
10
Tests/LibWeb/Text/input/HTML/Window-iterate-properties.html
Normal file
10
Tests/LibWeb/Text/input/HTML/Window-iterate-properties.html
Normal 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>
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue