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

Userland+Ladybird: Always specify url to be about:srcdoc in load_html()

After moving to navigables, we started reusing the code that populates
session history entries with the srcdoc attribute value from iframes
in `Page::load_html()` for loading HTML.

This change addresses a crash in `determine_the_origin` which occurred
because this method expected the URL to be `about:srcdoc` if we also
provided HTML content (previously, it was the URL passed along with the
HTML content into `load_html()`).
This commit is contained in:
Aliaksandr Kalenik 2023-09-17 17:12:17 +02:00 committed by Andreas Kling
parent 8e832a174e
commit 3c675e3f25
18 changed files with 31 additions and 32 deletions

View file

@ -119,10 +119,10 @@ void ConnectionFromClient::load_url(const URL& url)
page().load(url);
}
void ConnectionFromClient::load_html(DeprecatedString const& html, const URL& url)
void ConnectionFromClient::load_html(DeprecatedString const& html)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadHTML: html={}, url={}", html, url);
page().load_html(html, url);
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadHTML: html={}", html);
page().load_html(html);
}
void ConnectionFromClient::set_viewport_rect(Gfx::IntRect const& rect)
@ -481,7 +481,7 @@ void ConnectionFromClient::debug_request(DeprecatedString const& request, Deprec
auto maybe_link = document->query_selector("link[rel=match]"sv);
if (maybe_link.is_error() || !maybe_link.value()) {
// To make sure that we fail the ref-test if the link is missing, load the error page.
load_html("<h1>Failed to find &lt;link rel=&quot;match&quot; /&gt; in ref test page!</h1> Make sure you added it.", "about:blank"sv);
load_html("<h1>Failed to find &lt;link rel=&quot;match&quot; /&gt; in ref test page!</h1> Make sure you added it.");
} else {
auto link = maybe_link.release_value();
auto url = document->parse_url(link->get_attribute(Web::HTML::AttributeNames::href));

View file

@ -56,7 +56,7 @@ private:
virtual void update_system_fonts(DeprecatedString const&, DeprecatedString const&, DeprecatedString const&) override;
virtual void update_screen_rects(Vector<Gfx::IntRect> const&, u32) override;
virtual void load_url(URL const&) override;
virtual void load_html(DeprecatedString const&, URL const&) override;
virtual void load_html(DeprecatedString const&) override;
virtual void paint(Gfx::IntRect const&, i32) override;
virtual void set_viewport_rect(Gfx::IntRect const&) override;
virtual void mouse_down(Gfx::IntPoint, Gfx::IntPoint, unsigned, unsigned, unsigned) override;

View file

@ -19,7 +19,7 @@ endpoint WebContentServer
update_screen_rects(Vector<Gfx::IntRect> rects, u32 main_screen_index) =|
load_url(URL url) =|
load_html(DeprecatedString html, URL url) =|
load_html(DeprecatedString html) =|
add_backing_store(i32 backing_store_id, Gfx::ShareableBitmap bitmap) =|
remove_backing_store(i32 backing_store_id) =|