LibWeb: Verify something was removed in StyleSheetList::remove_sheet()

This would have saved me an hour of debugging, so putting it here for
the next person. :^)
This commit is contained in:
Andreas Kling 2024-07-23 09:50:48 +02:00 committed by Andreas Kling
commit ebacb921da
Notes: github-actions[bot] 2024-07-23 09:13:16 +00:00

View file

@ -115,7 +115,8 @@ void StyleSheetList::add_sheet(CSSStyleSheet& sheet)
void StyleSheetList::remove_sheet(CSSStyleSheet& sheet)
{
sheet.set_style_sheet_list({}, nullptr);
m_sheets.remove_first_matching([&](auto& entry) { return entry.ptr() == &sheet; });
bool did_remove = m_sheets.remove_first_matching([&](auto& entry) { return entry.ptr() == &sheet; });
VERIFY(did_remove);
if (sheet.rules().length() == 0) {
// NOTE: If the removed sheet had no rules, we don't have to invalidate anything.