mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-05 00:21:52 +00:00
LibWeb/HTML: Make HTMLImageRequests currentURL a String
This is the same type as what is spec'd. We cannot use a URL record for this member as the spec in some scenarios will set and compare the URL string to an invalid URL value, such as the empty string. With implicit string constructors for the URL class removed explicitly using URL::Parser::basic_parse makes the code look quite silly in those places.
This commit is contained in:
parent
9b7fb0850d
commit
f857c6a6e6
Notes:
github-actions[bot]
2025-03-04 21:26:48 +00:00
Author: https://github.com/shannonbooth
Commit: f857c6a6e6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3668
Reviewed-by: https://github.com/trflynn89
4 changed files with 30 additions and 34 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <AK/HashTable.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibURL/Parser.h>
|
||||
#include <LibWeb/Fetch/Fetching/Fetching.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchController.h>
|
||||
|
@ -67,16 +68,11 @@ void ImageRequest::set_state(State state)
|
|||
m_state = state;
|
||||
}
|
||||
|
||||
URL::URL const& ImageRequest::current_url() const
|
||||
{
|
||||
return m_current_url;
|
||||
}
|
||||
|
||||
void ImageRequest::set_current_url(JS::Realm& realm, URL::URL url)
|
||||
void ImageRequest::set_current_url(JS::Realm& realm, String url)
|
||||
{
|
||||
m_current_url = move(url);
|
||||
if (m_current_url.is_valid())
|
||||
m_shared_resource_request = SharedResourceRequest::get_or_create(realm, m_page, m_current_url);
|
||||
if (auto url = URL::Parser::basic_parse(m_current_url); url.has_value())
|
||||
m_shared_resource_request = SharedResourceRequest::get_or_create(realm, m_page, url.release_value());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/images.html#abort-the-image-request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue