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

@ -40,7 +40,7 @@
- (instancetype)init:(id<LadybirdWebViewObserver>)observer;
- (void)loadURL:(URL const&)url;
- (void)loadHTML:(StringView)html url:(URL const&)url;
- (void)loadHTML:(StringView)html;
- (WebView::ViewImplementation&)view;
- (String const&)handle;

View file

@ -109,9 +109,9 @@ struct HideCursor {
m_web_view_bridge->load(url);
}
- (void)loadHTML:(StringView)html url:(URL const&)url
- (void)loadHTML:(StringView)html
{
m_web_view_bridge->load_html(html, url);
m_web_view_bridge->load_html(html);
}
- (WebView::ViewImplementation&)view

View file

@ -91,7 +91,7 @@ enum class IsHistoryNavigation {
- (void)loadHTML:(StringView)html url:(URL const&)url
{
[[self tab].web_view loadHTML:html url:url];
[[self tab].web_view loadHTML:html];
}
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)isRedirect

View file

@ -442,10 +442,10 @@ Tab& BrowserWindow::new_tab(QString const& url, Web::HTML::ActivateTab activate_
return tab;
}
Tab& BrowserWindow::new_tab(StringView html, URL const& url, Web::HTML::ActivateTab activate_tab)
Tab& BrowserWindow::new_tab(StringView html, Web::HTML::ActivateTab activate_tab)
{
auto& tab = create_new_tab(activate_tab);
tab.load_html(html, url);
tab.load_html(html);
return tab;
}

View file

@ -70,7 +70,7 @@ public slots:
void tab_title_changed(int index, QString const&);
void tab_favicon_changed(int index, QIcon const& icon);
Tab& new_tab(QString const&, Web::HTML::ActivateTab);
Tab& new_tab(StringView html, URL const& url, Web::HTML::ActivateTab);
Tab& new_tab(StringView html, Web::HTML::ActivateTab);
void activate_tab(int index);
void close_tab(int index);
void close_current_tab();

View file

@ -217,7 +217,7 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path, WebView::
view().on_received_source = [this](auto const& url, auto const& source) {
auto html = WebView::highlight_source(url, source);
m_window->new_tab(html, url, Web::HTML::ActivateTab::Yes);
m_window->new_tab(html, Web::HTML::ActivateTab::Yes);
};
view().on_navigate_back = [this]() {
@ -550,9 +550,9 @@ void Tab::navigate(QString url_qstring)
view().load(url_string);
}
void Tab::load_html(StringView html, URL const& url)
void Tab::load_html(StringView html)
{
view().load_html(html, url);
view().load_html(html);
}
void Tab::back()

View file

@ -34,7 +34,7 @@ public:
WebContentView& view() { return *m_view; }
void navigate(QString);
void load_html(StringView, URL const&);
void load_html(StringView);
void back();
void forward();