浏览代码

Browser: Call url_from_user_input for home URL

This allows omitting HTTP scheme in home URLs.
Maciej 3 年之前
父节点
当前提交
d3fc3337ef
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2 2
      Userland/Applications/Browser/BrowserWindow.cpp
  2. 1 1
      Userland/Applications/Browser/main.cpp

+ 2 - 2
Userland/Applications/Browser/BrowserWindow.cpp

@@ -102,7 +102,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
     };
 
     m_window_actions.on_create_new_tab = [this] {
-        create_new_tab(Browser::g_home_url, true);
+        create_new_tab(Browser::url_from_user_input(Browser::g_home_url), true);
     };
 
     m_window_actions.on_next_tab = [this] {
@@ -171,7 +171,7 @@ void BrowserWindow::build_menus()
 
     m_go_back_action = GUI::CommonActions::make_go_back_action([this](auto&) { active_tab().go_back(); }, this);
     m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) { active_tab().go_forward(); }, this);
-    m_go_home_action = GUI::CommonActions::make_go_home_action([this](auto&) { active_tab().load(g_home_url); }, this);
+    m_go_home_action = GUI::CommonActions::make_go_home_action([this](auto&) { active_tab().load(Browser::url_from_user_input(g_home_url)); }, this);
     m_go_home_action->set_status_tip("Go to home page");
     m_reload_action = GUI::CommonActions::make_reload_action([this](auto&) { active_tab().reload(); }, this);
     m_reload_action->set_status_tip("Reload current page");

+ 1 - 1
Userland/Applications/Browser/main.cpp

@@ -92,7 +92,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
 
     TRY(load_content_filters());
 
-    URL first_url = Browser::g_home_url;
+    URL first_url = Browser::url_from_user_input(Browser::g_home_url);
     if (specified_url) {
         if (Core::File::exists(specified_url)) {
             first_url = URL::create_with_file_protocol(Core::File::real_path_for(specified_url));