mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 17:28:30 +00:00
LibWeb: Fix dialog.requestClose() crash
The spec previously asserted that close watcher was not null. This could lead to a crash in some situations, so instead we skip to close the dialog.
This commit is contained in:
committed by
Andreas Kling
parent
6147557999
commit
62f4cebbee
@@ -242,8 +242,11 @@ void HTMLDialogElement::request_close(Optional<String> return_value)
|
||||
// 1. If this does not have an open attribute, then return.
|
||||
if (!has_attribute(AttributeNames::open))
|
||||
return;
|
||||
// 2. Assert: this's close watcher is not null.
|
||||
VERIFY(m_close_watcher);
|
||||
// ADHOC: 2. If this's close watcher is null, then close the dialog this with returnValue, and return. See https://github.com/whatwg/html/pull/10983
|
||||
if (!m_close_watcher) {
|
||||
close_the_dialog(move(return_value));
|
||||
return;
|
||||
}
|
||||
// 3. Set dialog's enable close watcher for requestClose() to true.
|
||||
// ADHOC: Implemented slightly differently to the spec, as the spec is unnecessarily complex.
|
||||
m_close_watcher->set_enabled(true);
|
||||
|
||||
Reference in New Issue
Block a user