1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:07:45 +00:00

LibWeb: Make Fetch::Infrastructure::{Request,Response,HeaderList} GC'd

This is the way.

On a more serious note, there's no reason to keep adding ref-counted
classes to LibWeb now that the majority of classes is GC'd - it only
adds the risk of discovering some cycle down the line, and forces us to
use handles as we can't visit().
This commit is contained in:
Linus Groh 2022-10-30 01:52:07 +00:00
parent 63122d0276
commit b1968b8bed
19 changed files with 270 additions and 169 deletions

View file

@ -236,8 +236,10 @@ MimeSniff::MimeType XMLHttpRequest::get_final_mime_type() const
// https://xhr.spec.whatwg.org/#response-mime-type
MimeSniff::MimeType XMLHttpRequest::get_response_mime_type() const
{
auto& vm = this->vm();
// FIXME: Use an actual HeaderList for XHR headers.
auto header_list = make_ref_counted<Fetch::Infrastructure::HeaderList>();
auto header_list = Fetch::Infrastructure::HeaderList::create(vm);
for (auto const& entry : m_response_headers) {
auto header = Fetch::Infrastructure::Header::from_string_pair(entry.key, entry.value).release_value_but_fixme_should_propagate_errors();
header_list->append(move(header)).release_value_but_fixme_should_propagate_errors();