1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

Browser: Update Storage Inspector's cookie model when deleting cookies

We currently get a list of cookies when the Storage Inspector is opened
and never update that list when deleting cookies. This updates the
inspector to actually take cookies out of the model when deleting them,
rather than deleting a copy of them.
This commit is contained in:
Timothy Flynn 2022-11-01 08:30:03 -04:00 committed by Linus Groh
parent a9888d4ea0
commit d515929134
3 changed files with 21 additions and 10 deletions

View file

@ -101,10 +101,22 @@ TriState CookiesModel::data_matches(GUI::ModelIndex const& index, GUI::Variant c
return TriState::False;
}
Web::Cookie::Cookie const& CookiesModel::get_cookie(GUI::ModelIndex const& index) const
Web::Cookie::Cookie CookiesModel::take_cookie(GUI::ModelIndex const& index)
{
VERIFY(index.is_valid());
return m_cookies[index.row()];
auto cookie = m_cookies.take(index.row());
did_update(InvalidateAllIndices);
return cookie;
}
AK::Vector<Web::Cookie::Cookie> CookiesModel::take_all_cookies()
{
auto cookies = move(m_cookies);
did_update(InvalidateAllIndices);
return cookies;
}
}