LibWeb: Push promise rejection handling onto UniversalGlobalScopeMixin

This is needed for shadow realms which don't have a window or worker
global object. Fixes a crash for the attached test.
This commit is contained in:
Shannon Booth 2024-11-28 04:06:02 +13:00 committed by Andreas Kling
parent fb17f8ff66
commit 6a668f27c7
Notes: github-actions[bot] 2024-11-30 11:07:17 +00:00
9 changed files with 129 additions and 109 deletions

View file

@ -497,7 +497,7 @@ void EventLoop::perform_a_microtask_checkpoint()
// 4. For each environment settings object settingsObject whose responsible event loop is this event loop, notify about rejected promises given settingsObject's global object.
for (auto& environment_settings_object : m_related_environment_settings_objects) {
auto* global = dynamic_cast<HTML::WindowOrWorkerGlobalScopeMixin*>(&environment_settings_object->global_object());
auto* global = dynamic_cast<HTML::UniversalGlobalScopeMixin*>(&environment_settings_object->global_object());
VERIFY(global);
global->notify_about_rejected_promises({});
}