Initialize session in app/ private before adding URIs
If the session is not prepared properly URIs loading of the first page(s) breaks. Also it is a good idea to sort out all settings before loading anything to begin with. You will now see "midori_load_soup_session was not called!" if any pages try to load before the session is prepared. Fixes: https://bugs.launchpad.net/midori/+bug/814268
This commit is contained in:
parent
f2d1959e73
commit
3fc44b6fdc
2 changed files with 32 additions and 25 deletions
|
@ -1021,6 +1021,8 @@ midori_load_soup_session (gpointer settings)
|
||||||
|
|
||||||
midori_soup_session_debug (session);
|
midori_soup_session_debug (session);
|
||||||
|
|
||||||
|
g_object_set_data (G_OBJECT (session), "midori-session-initialized", (void*)1);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2170,25 +2172,6 @@ main (int argc,
|
||||||
else
|
else
|
||||||
settings = g_object_ref (midori_browser_get_settings (browser));
|
settings = g_object_ref (midori_browser_get_settings (browser));
|
||||||
|
|
||||||
if (webapp)
|
|
||||||
{
|
|
||||||
gchar* tmp_uri = midori_prepare_uri (webapp);
|
|
||||||
g_object_set (settings,
|
|
||||||
"show-menubar", FALSE,
|
|
||||||
"show-navigationbar", FALSE,
|
|
||||||
"toolbar-items", "Back,Forward,ReloadStop,Location,Homepage",
|
|
||||||
"homepage", tmp_uri,
|
|
||||||
"show-statusbar", FALSE,
|
|
||||||
"enable-developer-extras", FALSE,
|
|
||||||
NULL);
|
|
||||||
midori_browser_set_action_visible (browser, "Menubar", FALSE);
|
|
||||||
midori_browser_add_uri (browser, tmp_uri);
|
|
||||||
g_free (tmp_uri);
|
|
||||||
/* Update window icon according to page */
|
|
||||||
g_signal_connect (browser, "notify::load-status",
|
|
||||||
G_CALLBACK (midori_web_app_browser_notify_load_status_cb), NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (private)
|
if (private)
|
||||||
{
|
{
|
||||||
g_object_set (settings,
|
g_object_set (settings,
|
||||||
|
@ -2211,6 +2194,31 @@ main (int argc,
|
||||||
sokoke_set_config_dir ("/");
|
sokoke_set_config_dir ("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
midori_load_soup_session (settings);
|
||||||
|
if (block_uris)
|
||||||
|
g_signal_connect (session, "request-queued",
|
||||||
|
G_CALLBACK (midori_soup_session_block_uris_cb),
|
||||||
|
g_strdup (block_uris));
|
||||||
|
|
||||||
|
if (webapp)
|
||||||
|
{
|
||||||
|
gchar* tmp_uri = midori_prepare_uri (webapp);
|
||||||
|
g_object_set (settings,
|
||||||
|
"show-menubar", FALSE,
|
||||||
|
"show-navigationbar", FALSE,
|
||||||
|
"toolbar-items", "Back,Forward,ReloadStop,Location,Homepage",
|
||||||
|
"homepage", tmp_uri,
|
||||||
|
"show-statusbar", FALSE,
|
||||||
|
"enable-developer-extras", FALSE,
|
||||||
|
NULL);
|
||||||
|
midori_browser_set_action_visible (browser, "Menubar", FALSE);
|
||||||
|
midori_browser_add_uri (browser, tmp_uri);
|
||||||
|
g_free (tmp_uri);
|
||||||
|
/* Update window icon according to page */
|
||||||
|
g_signal_connect (browser, "notify::load-status",
|
||||||
|
G_CALLBACK (midori_web_app_browser_notify_load_status_cb), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
g_object_set (settings, "show-panel", FALSE,
|
g_object_set (settings, "show-panel", FALSE,
|
||||||
"last-window-state", MIDORI_WINDOW_NORMAL,
|
"last-window-state", MIDORI_WINDOW_NORMAL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -2242,12 +2250,7 @@ main (int argc,
|
||||||
if (midori_browser_get_current_uri (browser) == NULL)
|
if (midori_browser_get_current_uri (browser) == NULL)
|
||||||
midori_browser_add_uri (browser, "about:blank");
|
midori_browser_add_uri (browser, "about:blank");
|
||||||
|
|
||||||
if (block_uris)
|
|
||||||
g_signal_connect (session, "request-queued",
|
|
||||||
G_CALLBACK (midori_soup_session_block_uris_cb),
|
|
||||||
g_strdup (block_uris));
|
|
||||||
midori_setup_inactivity_reset (browser, inactivity_reset, webapp);
|
midori_setup_inactivity_reset (browser, inactivity_reset, webapp);
|
||||||
midori_load_soup_session (settings);
|
|
||||||
midori_startup_timer ("App created: \t%f");
|
midori_startup_timer ("App created: \t%f");
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -6819,6 +6819,10 @@ midori_browser_add_tab (MidoriBrowser* browser,
|
||||||
g_return_val_if_fail (MIDORI_IS_BROWSER (browser), -1);
|
g_return_val_if_fail (MIDORI_IS_BROWSER (browser), -1);
|
||||||
g_return_val_if_fail (GTK_IS_WIDGET (view), -1);
|
g_return_val_if_fail (GTK_IS_WIDGET (view), -1);
|
||||||
|
|
||||||
|
if (!g_object_get_data (G_OBJECT (webkit_get_default_session ()),
|
||||||
|
"midori-session-initialized"))
|
||||||
|
g_critical ("midori_load_soup_session was not called!");
|
||||||
|
|
||||||
g_signal_emit (browser, signals[ADD_TAB], 0, view);
|
g_signal_emit (browser, signals[ADD_TAB], 0, view);
|
||||||
return gtk_notebook_page_num (GTK_NOTEBOOK (browser->notebook), view);
|
return gtk_notebook_page_num (GTK_NOTEBOOK (browser->notebook), view);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue