1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:37:35 +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

@ -505,5 +505,5 @@ void MailWidget::selected_email_to_load(GUI::ModelIndex const& index)
// FIXME: I'm not sure what the URL should be. Just use the default URL "about:blank".
// FIXME: It would be nice if we could pass over the charset.
// FIXME: Add ability to cancel the load when we switch to another email. Feels very sluggish on heavy emails otherwise
m_web_view->load_html(decoded_data, "about:blank"sv);
m_web_view->load_html(decoded_data);
}

View file

@ -152,7 +152,7 @@ void PresenterWidget::set_file(StringView file_name)
m_current_presentation = presentation.release_value();
window()->set_title(DeprecatedString::formatted(title_template, m_current_presentation->title(), m_current_presentation->author()));
set_min_size(m_current_presentation->normative_size());
m_web_view->load_html(MUST(m_current_presentation->render()), "presenter://slide.html"sv);
m_web_view->load_html(MUST(m_current_presentation->render()));
update_slides_actions();
}
}

View file

@ -909,7 +909,7 @@ void MainWidget::update_markdown_preview()
if (document) {
auto html = document->render_to_html();
auto current_scroll_pos = m_page_view->visible_content_rect();
m_page_view->load_html(html, URL::create_with_file_scheme(m_path));
m_page_view->load_html(html);
m_page_view->scroll_into_view(current_scroll_pos, true, true);
}
}
@ -917,7 +917,7 @@ void MainWidget::update_markdown_preview()
void MainWidget::update_html_preview()
{
auto current_scroll_pos = m_page_view->visible_content_rect();
m_page_view->load_html(m_editor->text(), URL::create_with_file_scheme(m_path));
m_page_view->load_html(m_editor->text());
m_page_view->scroll_into_view(current_scroll_pos, true, true);
}