1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 20:22:13 +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

@ -86,15 +86,14 @@ void ViewImplementation::load(AK::URL const& url)
client().async_load_url(url);
}
void ViewImplementation::load_html(StringView html, AK::URL const& url)
void ViewImplementation::load_html(StringView html)
{
m_url = url;
client().async_load_html(html, url);
client().async_load_html(html);
}
void ViewImplementation::load_empty_document()
{
load_html(""sv, {});
load_html(""sv);
}
void ViewImplementation::zoom_in()
@ -328,7 +327,7 @@ void ViewImplementation::handle_web_content_process_crash()
auto escaped_url = escape_html_entities(m_url.to_deprecated_string());
builder.appendff("The web page <a href=\"{}\">{}</a> has crashed.<br><br>You can reload the page to try again.", escaped_url, escaped_url);
builder.append("</body></html>"sv);
load_html(builder.to_deprecated_string(), m_url);
load_html(builder.to_deprecated_string());
}
ErrorOr<void> ViewImplementation::take_screenshot(ScreenshotType type)