summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2017-03-25 10:16:45 +0100
committerPeter Hofmann <scm@uninformativ.de>2017-03-25 10:16:45 +0100
commitca8e93d9b348a834c949c694c9a2cdba9ddf7523 (patch)
treef80ef8da80a66ffcf19febe56df62e8a4bd5e8a2
parent076217013f1ce9d3c7f1759f7923e1a3da7853d7 (diff)
downloadlariza-ca8e93d9b348a834c949c694c9a2cdba9ddf7523.tar.gz
Remove autoreloading of crashed windows
CC #32.
-rw-r--r--CHANGES5
-rw-r--r--browser.c53
-rw-r--r--man1/lariza.111
3 files changed, 28 insertions, 41 deletions
diff --git a/CHANGES b/CHANGES
index c73601a..bc51139 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,11 @@ next
- Automatically adding the "file://" prefix didn't work (reliably) if
a message was sent to an already running instance.
+ [Changed]
+ - Autoreloading of crashed web processes has been removed. It doesn't
+ make sense anymore since the switch to webkit's multi-process model.
+ Instead, we now simply announce the crash in the location bar.
+
v17.02 2017-02-16
[Fixed]
- As requested by WebKit's API documentation, we now wait for the
diff --git a/browser.c b/browser.c
index 112c698..6c4e849 100644
--- a/browser.c
+++ b/browser.c
@@ -24,7 +24,6 @@ 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);
@@ -73,7 +72,6 @@ static gint clients = 0;
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 = "/var/tmp";
static Window embed = 0;
static gchar *fifo_suffix = "main";
@@ -348,42 +346,41 @@ changed_uri(GObject *obj, GParamSpec *pspec, gpointer data)
FILE *fp;
t = webkit_web_view_get_uri(WEBKIT_WEB_VIEW(c->web_view));
- gtk_entry_set_text(GTK_ENTRY(c->location), (t == NULL ? __NAME__ : t));
- if (t != NULL && history_file != NULL)
+ /* When a web process crashes, we get a "notify::uri" signal, but we
+ * can no longer read a meaningful URI. It's just an empty string
+ * now. Not updating the location bar in this scenario is important,
+ * because we would override the "WEB PROCESS CRASHED" message. */
+ if (t != NULL && strlen(t) > 0)
{
- fp = fopen(history_file, "a");
- if (fp != NULL)
+ gtk_entry_set_text(GTK_ENTRY(c->location), t);
+
+ if (history_file != NULL)
{
- fprintf(fp, "%s\n", t);
- fclose(fp);
+ fp = fopen(history_file, "a");
+ if (fp != NULL)
+ {
+ fprintf(fp, "%s\n", t);
+ fclose(fp);
+ }
+ else
+ perror(__NAME__": Error opening history file");
}
- else
- perror(__NAME__": Error opening history file");
}
}
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;
-}
+ gchar *t;
+ struct Client *c = (struct Client *)data;
-gboolean
-crashed_web_view_reload(gpointer data)
-{
- webkit_web_view_reload_bypass_cache(WEBKIT_WEB_VIEW(data));
+ t = g_strdup_printf("WEB PROCESS CRASHED: %s",
+ webkit_web_view_get_uri(WEBKIT_WEB_VIEW(web_view)));
+ gtk_entry_set_text(GTK_ENTRY(c->location), t);
+ g_free(t);
- return G_SOURCE_REMOVE;
+ return TRUE;
}
gboolean
@@ -566,10 +563,6 @@ grab_environment_configuration(void)
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);
diff --git a/man1/lariza.1 b/man1/lariza.1
index 666af3e..5ea1f65 100644
--- a/man1/lariza.1
+++ b/man1/lariza.1
@@ -39,17 +39,6 @@ about the following environment variables:
In HTTP requests, WebKit sets the \(lqAccepted-Language\(rq header to
this value. Defaults to \fBen-US\fP.
.TP
-\fBLARIZA_CRASH_AUTORELOAD_DELAY\fP
-If/when the WebKit process crashes, \fBlariza\fP's main process will
-receive a signal and can act accordingly. The default value of this
-variable is \fB2\fP, which means that \fBlariza\fP will wait two seconds
-and then reload each window/tab.
-
-If you set $\fBLARIZA_CRASH_AUTORELOAD_DELAY\fP to zero or any negative
-value, then \fBlariza\fP will not automatically reload anything. Note,
-however, that you can still do this manually by pressing the
-\(lqreload\(rq hotkey for each window.
-.TP
\fBLARIZA_DOWNLOAD_DIR\fP
All downloads are automatically stored in this directory. If you want to
stick to XDG directories, then you should configure your