aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2013-02-24 02:55:56 +0800
committerXan Lopez <xan@igalia.com>2013-03-11 20:40:21 +0800
commit4369ae9aa3cd7abeb03e156abb994616b4c11441 (patch)
tree296a87f9ca2739aa5156a38a0e18ccc15595bd89 /embed
parent6da63a35ffe4254084c80d5abb568f9e9906be5a (diff)
downloadgsoc2013-epiphany-4369ae9aa3cd7abeb03e156abb994616b4c11441.tar
gsoc2013-epiphany-4369ae9aa3cd7abeb03e156abb994616b4c11441.tar.gz
gsoc2013-epiphany-4369ae9aa3cd7abeb03e156abb994616b4c11441.tar.bz2
gsoc2013-epiphany-4369ae9aa3cd7abeb03e156abb994616b4c11441.tar.lz
gsoc2013-epiphany-4369ae9aa3cd7abeb03e156abb994616b4c11441.tar.xz
gsoc2013-epiphany-4369ae9aa3cd7abeb03e156abb994616b4c11441.tar.zst
gsoc2013-epiphany-4369ae9aa3cd7abeb03e156abb994616b4c11441.zip
Show an error page when the WebProcess crashes
https://bugzilla.gnome.org/show_bug.cgi?id=693832
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-web-view.c46
-rw-r--r--embed/ephy-web-view.h3
2 files changed, 48 insertions, 1 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 4f739f357..b37597991 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -102,6 +102,7 @@ struct _EphyWebViewPrivate {
GCancellable *history_service_cancellable;
guint snapshot_idle_id;
+ guint show_process_crash_page_id;
EphyHistoryPageVisitType visit_type;
@@ -498,6 +499,11 @@ ephy_web_view_dispose (GObject *object)
priv->snapshot_idle_id = 0;
}
+ if (priv->show_process_crash_page_id) {
+ g_source_remove (priv->show_process_crash_page_id);
+ priv->show_process_crash_page_id = 0;
+ }
+
g_clear_object(&priv->certificate);
G_OBJECT_CLASS (ephy_web_view_parent_class)->dispose (object);
@@ -1272,6 +1278,31 @@ hovering_over_link_cb (EphyWebView *web_view,
}
#endif
+#ifdef HAVE_WEBKIT2
+static gboolean
+load_process_crashed_page_cb (EphyWebView *web_view)
+{
+ const char *uri = ephy_web_view_get_address (web_view);
+ ephy_web_view_load_error_page (web_view, uri, EPHY_WEB_VIEW_ERROR_PROCESS_CRASH, NULL);
+
+ web_view->priv->show_process_crash_page_id = 0;
+
+ return FALSE;
+}
+
+static void
+process_crashed_cb (WebKitWebView *web_view, gpointer user_data)
+{
+ EphyWebViewPrivate *priv = web_view->priv;
+
+ g_return_if_fail (priv->show_process_crash_page_id == 0);
+ priv->show_process_crash_page_id = g_idle_add_full (G_PRIORITY_LOW,
+ (GSourceFunc)load_process_crashed_page_cb,
+ web_view,
+ NULL);
+}
+#endif
+
static void
ephy_web_view_constructed (GObject *object)
{
@@ -1289,6 +1320,11 @@ ephy_web_view_constructed (GObject *object)
#endif
g_signal_emit_by_name (ephy_embed_shell_get_default (), "web-view-created", object);
+
+#ifdef HAVE_WEBKIT2
+ g_signal_connect (object, "web-process-crashed",
+ G_CALLBACK (process_crashed_cb), object);
+#endif
}
static void
@@ -2389,6 +2425,16 @@ ephy_web_view_load_error_page (EphyWebView *view,
html_file = ephy_file ("recovery.html");
stock_icon = "dialog-information";
break;
+ case EPHY_WEB_VIEW_ERROR_PROCESS_CRASH:
+ page_title = g_strdup_printf (_("Oops! Something went wrong displaying %s"), hostname);
+ msg_title = g_strdup (_("Oops!"));
+ msg = g_strdup (_("Something went wrong while displaying this page. Please reload or visit a different page to continue."));
+ button_label = NULL;
+
+ html_file = ephy_file ("process_crash.html");
+ stock_icon = "computer-fail-symbolic";
+
+ break;
default:
return;
break;
diff --git a/embed/ephy-web-view.h b/embed/ephy-web-view.h
index 515880430..46c84f95b 100644
--- a/embed/ephy-web-view.h
+++ b/embed/ephy-web-view.h
@@ -81,7 +81,8 @@ typedef enum
typedef enum {
EPHY_WEB_VIEW_ERROR_PAGE_NETWORK_ERROR,
- EPHY_WEB_VIEW_ERROR_PAGE_CRASH
+ EPHY_WEB_VIEW_ERROR_PAGE_CRASH,
+ EPHY_WEB_VIEW_ERROR_PROCESS_CRASH
} EphyWebViewErrorPage;
struct _EphyWebView