aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--data/pages/Makefile.am1
-rw-r--r--data/pages/process_crash.html74
-rw-r--r--embed/ephy-web-view.c46
-rw-r--r--embed/ephy-web-view.h3
4 files changed, 123 insertions, 1 deletions
diff --git a/data/pages/Makefile.am b/data/pages/Makefile.am
index 5062f0989..4b00a41b5 100644
--- a/data/pages/Makefile.am
+++ b/data/pages/Makefile.am
@@ -1,6 +1,7 @@
errorpagesdir = $(pkgdatadir)/pages
errorpages_DATA = \
recovery.html \
+ process_crash.html \
error.html
stylepagesdir = $(pkgdatadir)/pages
diff --git a/data/pages/process_crash.html b/data/pages/process_crash.html
new file mode 100644
index 000000000..7cf7ab93c
--- /dev/null
+++ b/data/pages/process_crash.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!--
+ Copyright © 2013 Igalia S.L.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="%s" lang="%s" dir="%s">
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <title>%s</title>
+ <style type="text/css">
+ body {
+ margin: 0 auto;
+ font: message-box;
+ background-color: #2e3436;
+ color: #d0d1cf;
+ }
+
+ #container {
+ padding: 10% 12% 5%;
+ margin: 0 auto;
+ max-width: 650px;
+ }
+
+ #main_icon {
+ float: left;
+ padding-right: 20px;
+ }
+
+ html[dir="rtl"] #main_icon {
+ padding-left: 20px;
+ padding-right: 0;
+ float: right;
+ }
+
+ #content {
+ display: table-cell;
+ vertical-align: top;
+ }
+
+ #content h1 {
+ margin-top: 0;
+ font-size: 200%;
+ }
+ </style>
+
+</head>
+<body>
+ <div id="container">
+ <div id="main_icon">
+ <!-- We do nothing with the URI for now: %s -->
+ <img width="150px" height="150px" src="%s" alt="Sad face icon"/>
+ </div>
+ <div id="content">
+ <h1>%s</h1>
+ <div class="explanation">
+ %s
+ </div>
+ </div>
+ </div>
+</body>
+</html>
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