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:
Shannon Booth 2025-02-22 20:16:45 +13:00 committed by Tim Flynn
commit f857c6a6e6
Notes: github-actions[bot] 2025-03-04 21:26:48 +00:00
4 changed files with 30 additions and 34 deletions

View file

@ -39,8 +39,8 @@ public:
State state() const;
void set_state(State);
URL::URL const& current_url() const;
void set_current_url(JS::Realm&, URL::URL);
String const& current_url() const { return m_current_url; }
void set_current_url(JS::Realm&, String);
[[nodiscard]] GC::Ptr<DecodedImageData> image_data() const;
void set_image_data(GC::Ptr<DecodedImageData>);
@ -72,7 +72,7 @@ private:
// https://html.spec.whatwg.org/multipage/images.html#img-req-url
// An image request's current URL is initially the empty string.
URL::URL m_current_url;
String m_current_url;
// https://html.spec.whatwg.org/multipage/images.html#img-req-data
GC::Ptr<DecodedImageData> m_image_data;