In HTTP requests, WebKit sets the "Accepted-Language" header to
this value. Defaults to "en-US".
+ LARIZA_CRASH_AUTORELOAD_DELAY
+ If/when the WebKit process crashes, lariza's main process will
+ receive a signal and can act accordingly. The default value of
+ this variable is "2", which means that lariza will wait two
+ seconds and then reload each window/tab.
+
+ If you set $LARIZA_CRASH_AUTORELOAD_DELAY to zero or any
+ negative value, then lariza will not automatically reload
+ anything. Note, however, that you can still do this manually by
+ pressing the "reload" hotkey for each window.
+
LARIZA_DOWNLOAD_DIR
All downloads are automatically stored in this directory.
Defaults to "/tmp".
static void changed_load_progress(GObject *, GParamSpec *, gpointer);
static void changed_title(GObject *, GParamSpec *, gpointer);
static void changed_uri(GObject *, GParamSpec *, gpointer);
+static gboolean crashed_web_view(WebKitWebView *, gpointer);
+static gboolean crashed_web_view_reload(gpointer);
static gboolean decide_policy(WebKitWebView *, WebKitPolicyDecision *,
WebKitPolicyDecisionType, gpointer);
static gboolean download_handle(WebKitDownload *, gchar *, gpointer);
static gboolean cooperative_alone = TRUE;
static gboolean cooperative_instances = TRUE;
static int cooperative_pipe_fp = 0;
+static int crash_autoreload_delay = 2;
static gchar *download_dir = "/tmp";
static Window embed = 0;
static gchar *fifo_suffix = "main";
G_CALLBACK(key_web_view), c);
g_signal_connect(G_OBJECT(c->web_view), "mouse-target-changed",
G_CALLBACK(hover_web_view), c);
+ g_signal_connect(G_OBJECT(c->web_view), "web-process-crashed",
+ G_CALLBACK(crashed_web_view), c);
if (!initial_wc_setup_done)
{
gtk_entry_set_text(GTK_ENTRY(c->location), (t == NULL ? __NAME__ : t));
}
+gboolean
+crashed_web_view(WebKitWebView *web_view, gpointer data)
+{
+ fprintf(stderr, __NAME__": WebView crashed!\n");
+ if (crash_autoreload_delay >= 1)
+ {
+ fprintf(stderr, __NAME__": Reloading WebView in %d seconds.\n",
+ crash_autoreload_delay);
+ g_timeout_add_seconds(crash_autoreload_delay, crashed_web_view_reload,
+ web_view);
+ }
+
+ return TRUE;
+}
+
+gboolean
+crashed_web_view_reload(gpointer data)
+{
+ webkit_web_view_reload_bypass_cache(WEBKIT_WEB_VIEW(data));
+
+ return G_SOURCE_REMOVE;
+}
+
gboolean
decide_policy(WebKitWebView *web_view, WebKitPolicyDecision *decision,
WebKitPolicyDecisionType type, gpointer data)
if (e != NULL)
accepted_language[0] = g_strdup(e);
+ e = g_getenv(__NAME_UPPERCASE__"_CRASH_AUTORELOAD_DELAY");
+ if (e != NULL)
+ crash_autoreload_delay = atoi(e);
+
e = g_getenv(__NAME_UPPERCASE__"_DOWNLOAD_DIR");
if (e != NULL)
download_dir = g_strdup(e);