aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--embed/ephy-download.c1
-rw-r--r--src/ephy-shell.c14
2 files changed, 12 insertions, 3 deletions
diff --git a/embed/ephy-download.c b/embed/ephy-download.c
index 988a0abdb..445748299 100644
--- a/embed/ephy-download.c
+++ b/embed/ephy-download.c
@@ -1062,6 +1062,7 @@ ephy_download_new_for_download (WebKitDownload *download,
ephy_download->priv->download = g_object_ref (download);
#ifdef HAVE_WEBKIT2
+ g_object_set_data (G_OBJECT (download), "ephy-download-set", GINT_TO_POINTER (TRUE));
request = webkit_download_get_request (download);
ephy_download->priv->source = g_strdup (webkit_uri_request_get_uri (request));
#else
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 1ae07ac6a..452ded781 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -595,10 +595,9 @@ download_started_cb (WebKitWebContext *web_context,
WebKitDownload *download,
EphyShell *shell)
{
- EphyDownload *ed;
GtkWindow *window = NULL;
WebKitWebView *web_view;
- GtkWidget *toplevel;
+ gboolean ephy_download_set;
/* Is download locked down? */
if (g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
@@ -607,6 +606,15 @@ download_started_cb (WebKitWebContext *web_context,
return;
}
+ /* Only create an EphyDownload for the WebKitDownload if it doesn't exist yet.
+ * This can happen when the download has been started automatically by WebKit,
+ * due to a context menu action or policy checker decision. Downloads started
+ * explicitly by Epiphany are marked with ephy-download-set GObject data.
+ */
+ ephy_download_set = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (download), "ephy-download-set"));
+ if (ephy_download_set)
+ return;
+
web_view = webkit_download_get_web_view (download);
if (web_view) {
GtkWidget *toplevel;
@@ -619,7 +627,7 @@ download_started_cb (WebKitWebContext *web_context,
if (!window)
window = gtk_application_get_active_window (GTK_APPLICATION (shell));
- ed = ephy_download_new_for_download (download, window);
+ ephy_download_new_for_download (download, window);
}
#endif