]> git.armaanb.net Git - chorizo.git/commitdiff
Remove autoreloading of crashed windows
authorPeter Hofmann <scm@uninformativ.de>
Sat, 25 Mar 2017 09:16:45 +0000 (10:16 +0100)
committerPeter Hofmann <scm@uninformativ.de>
Sat, 25 Mar 2017 09:16:45 +0000 (10:16 +0100)
CC #32.

CHANGES
browser.c
man1/lariza.1

diff --git a/CHANGES b/CHANGES
index c73601aa1347ae859c0e3a5500eac1b5b734a9a5..bc5113942eab6c98a95cc9fdcd462908c983b320 100644 (file)
--- 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
index 112c698406472393ad2204a7d284fb1202a72c8e..6c4e849a79b655ec64a831f0d3dd347fe8851a4a 100644 (file)
--- 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);
index 666af3e1ff3fe3ff71731aefc6348117d474ebb2..5ea1f651885b2b43d192276f6cda198e0240913b 100644 (file)
@@ -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