mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:37:35 +00:00
Ladybird: Move the initial blank page load to BrowserWindow
Takes care of a FIXME :^)
This commit is contained in:
parent
5e89773937
commit
194ddca24f
3 changed files with 15 additions and 13 deletions
|
@ -366,6 +366,14 @@ void BrowserWindow::new_tab()
|
||||||
};
|
};
|
||||||
|
|
||||||
tab_ptr->focus_location_editor();
|
tab_ptr->focus_location_editor();
|
||||||
|
|
||||||
|
// This is a hack to make the JS console usable in new windows.
|
||||||
|
// Note we *don't* load the initial page if we are connected to a WebDriver, as the Set URL command may come in very
|
||||||
|
// quickly, and become replaced by this load.
|
||||||
|
if (m_webdriver_content_ipc_path.is_empty()) {
|
||||||
|
// We make it HistoryNavigation so that the initial page doesn't get added to the history.
|
||||||
|
tab_ptr->navigate("about:blank", Tab::LoadType::HistoryNavigation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWindow::close_tab(int index)
|
void BrowserWindow::close_tab(int index)
|
||||||
|
|
|
@ -144,17 +144,6 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path)
|
||||||
m_window->showFullScreen();
|
m_window->showFullScreen();
|
||||||
return Gfx::IntRect { m_window->x(), m_window->y(), m_window->width(), m_window->height() };
|
return Gfx::IntRect { m_window->x(), m_window->y(), m_window->width(), m_window->height() };
|
||||||
});
|
});
|
||||||
|
|
||||||
// FIXME: This is a hack to make the JS console usable in new windows.
|
|
||||||
// Something else should ensure that there's an initial about:blank document loaded in the view.
|
|
||||||
// We set m_is_history_navigation = true so that the initial about:blank doesn't get added to the history.
|
|
||||||
//
|
|
||||||
// Note we *don't* do this if we are connected to a WebDriver, as the Set URL command may come in very
|
|
||||||
// quickly, and become replaced by this load.
|
|
||||||
if (webdriver_content_ipc_path.is_empty()) {
|
|
||||||
m_is_history_navigation = true;
|
|
||||||
m_view->load("about:blank"sv);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::focus_location_editor()
|
void Tab::focus_location_editor()
|
||||||
|
@ -163,10 +152,11 @@ void Tab::focus_location_editor()
|
||||||
m_location_edit->selectAll();
|
m_location_edit->selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::navigate(QString url)
|
void Tab::navigate(QString url, LoadType load_type)
|
||||||
{
|
{
|
||||||
if (!url.startsWith("http://", Qt::CaseInsensitive) && !url.startsWith("https://", Qt::CaseInsensitive) && !url.startsWith("file://", Qt::CaseInsensitive) && !url.startsWith("about:", Qt::CaseInsensitive))
|
if (!url.startsWith("http://", Qt::CaseInsensitive) && !url.startsWith("https://", Qt::CaseInsensitive) && !url.startsWith("file://", Qt::CaseInsensitive) && !url.startsWith("about:", Qt::CaseInsensitive))
|
||||||
url = "http://" + url;
|
url = "http://" + url;
|
||||||
|
m_is_history_navigation = (load_type == LoadType::HistoryNavigation);
|
||||||
view().load(ak_deprecated_string_from_qstring(url));
|
view().load(ak_deprecated_string_from_qstring(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,11 @@ public:
|
||||||
|
|
||||||
WebContentView& view() { return *m_view; }
|
WebContentView& view() { return *m_view; }
|
||||||
|
|
||||||
void navigate(QString);
|
enum class LoadType {
|
||||||
|
Normal,
|
||||||
|
HistoryNavigation,
|
||||||
|
};
|
||||||
|
void navigate(QString, LoadType = LoadType::Normal);
|
||||||
|
|
||||||
void debug_request(DeprecatedString const& request, DeprecatedString const& argument);
|
void debug_request(DeprecatedString const& request, DeprecatedString const& argument);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue