summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@gnome.org>2021-02-16 10:17:43 -0600
committerMichael Catanzaro <mcatanzaro@gnome.org>2021-02-16 10:21:01 -0600
commit7862a5156b7aff3d4bc38246ec498554b22b9748 (patch)
tree0cb78b94f86f85bb53771c0baac0c5b0955b089f
parent8f833666c384a9c9f5d376ff15595e8bbece90a3 (diff)
downloadepiphany-mcatanzaro/#1447.tar.gz
web-view: fix reloading crashed pagesmcatanzaro/#1447
When the web process crashes, we generate an error page that reloads the view's current URI when the reload button is pressed. Unfortunately, since WebKit r268097, the current URI is now an empty string at the time of crash because the web process termination signal is dispatched asynchronously after WebKit has already updated the view to contain an empty page. This means we have to manually keep track of the previous value of the URI. Arguably, this is a bug in WebKit, but it seems tough to fix there and we need a workaround for now. Note that the web process termination signal is currently only being sent when running under flatpak. Outside flatpak, the signal is not sent at all. That is a separate issue (WebKit#221489) that we will not fix here. Fixes #1447
-rw-r--r--embed/ephy-web-view.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 4bf68f174..77150bdfa 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -88,6 +88,7 @@ struct _EphyWebView {
char *display_address;
char *typed_address;
char *last_committed_address;
+ char *last_nonempty_address;
char *loading_message;
char *link_message;
GdkPixbuf *icon;
@@ -784,6 +785,11 @@ ephy_web_view_set_address (EphyWebView *view,
if (!was_empty && ephy_web_view_is_loading (view) && view->typed_address != NULL)
ephy_web_view_set_typed_address (view, NULL);
+ if (g_strcmp0 (address, "")) {
+ g_free (view->last_nonempty_address);
+ view->last_nonempty_address = g_strdup (address);
+ }
+
g_object_notify_by_pspec (object, obj_properties[PROP_ADDRESS]);
g_object_notify_by_pspec (object, obj_properties[PROP_DISPLAY_ADDRESS]);
}
@@ -829,7 +835,7 @@ process_terminated_cb (EphyWebView *web_view,
}
if (!ephy_embed_has_load_pending (EPHY_GET_EMBED_FROM_EPHY_WEB_VIEW (web_view))) {
- ephy_web_view_load_error_page (web_view, ephy_web_view_get_address (web_view),
+ ephy_web_view_load_error_page (web_view, web_view->last_nonempty_address,
EPHY_WEB_VIEW_ERROR_PROCESS_CRASH, NULL, NULL);
}
}
@@ -3753,6 +3759,7 @@ ephy_web_view_finalize (GObject *object)
g_free (view->display_address);
g_free (view->typed_address);
g_free (view->last_committed_address);
+ g_free (view->last_nonempty_address);
g_free (view->link_message);
g_free (view->loading_message);
g_free (view->tls_error_failing_uri);