[epiphany] Remove support for browser plugins



commit 9e1457f64b44d6847ea6b75a096aec105691c996
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Oct 14 14:10:57 2016 -0500

    Remove support for browser plugins
    
    All browser vendors agree: plugins were a mistake. I no longer intend to
    support browser plugins in Epiphany. Windowed plugins only work in X11,
    the amount of crash reports from plugins is absurd, it's time for the
    GNOME Shell browser plugin to go, Evince browser plugin is far too
    buggy, the only plugin that still really matters is Flash, and Firefox
    and Chrome are slowly killing that too. If you want Flash, go use one
    of those browsers or MiniBrowser or whatever.
    
    Note that plugins are unrelated to extensions. We do wish to support
    Firefox/Chrome WebExtensions. Everyone likes extensions.

 data/org.gnome.epiphany.gschema.xml |    4 --
 embed/ephy-about-handler.c          |   85 +----------------------------------
 embed/ephy-embed-prefs.c            |    5 +--
 lib/ephy-prefs.h                    |    1 -
 src/prefs-dialog.c                  |    7 ---
 src/resources/prefs-dialog.ui       |    7 ---
 6 files changed, 2 insertions(+), 107 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index 62e0190..187e3e9 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -185,10 +185,6 @@
                        <summary>Allow popups</summary>
                        <description>Allow sites to open new windows using JavaScript (if JavaScript is 
enabled).</description>
                </key>
-               <key type="b" name="enable-plugins">
-                       <default>true</default>
-                       <summary>Enable Plugins</summary>
-               </key>
                <key type="b" name="enable-webgl">
                        <default>true</default>
                        <summary>Enable WebGL</summary>
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index f7be7c9..c81a2e8 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -119,87 +119,6 @@ ephy_about_request_free (EphyAboutRequest *about_request)
 }
 
 static void
-get_plugins_cb (WebKitWebContext *web_context,
-                GAsyncResult     *result,
-                EphyAboutRequest *about_request)
-{
-  GString *data_str;
-  gsize data_length;
-  GList *plugin_list, *p;
-  gboolean enabled;
-
-  enabled = g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_PLUGINS);
-
-  data_str = g_string_new ("<html>");
-  g_string_append_printf (data_str, "<head><title>%s</title>"
-                          "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
-                          "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\" 
type=\"text/css\">"
-                          "</head><body>",
-                          _("Installed plugins"));
-  g_string_append_printf (data_str, "<h1>%s</h1>", _("Plugins"));
-
-  if (!enabled)
-    g_string_append_printf (data_str, "<p><b>%s</b></p>", _("Plugins are disabled in the preferences"));
-
-  plugin_list = webkit_web_context_get_plugins_finish (web_context, result, NULL);
-  for (p = plugin_list; p; p = p->next) {
-    WebKitPlugin *plugin = WEBKIT_PLUGIN (p->data);
-    GList *m, *mime_types;
-
-    /* TODO: Enable/disable plugins in WebKit2 */
-    g_string_append_printf (data_str, "<h2>%s</h2>%s<br>%s: <b>%s</b>"  \
-                            "<table id=\"plugin-table\">"               \
-                            "  <thead><tr><th>%s</th><th>%s</th><th>%s</th></tr></thead><tbody>",
-                            webkit_plugin_get_name (plugin),
-                            webkit_plugin_get_description (plugin),
-                            _("Enabled"), /*webkit_plugin_get_enabled (plugin) && */ enabled ? _("Yes") : 
_("No"),
-                            _("MIME type"), _("Description"), _("Suffixes"));
-
-    mime_types = webkit_plugin_get_mime_info_list (plugin);
-
-    for (m = mime_types; m; m = m->next) {
-      WebKitMimeInfo *mime_info = (WebKitMimeInfo *)m->data;
-      const gchar * const *extensions;
-      guint i;
-
-      g_string_append_printf (data_str, "<tr><td>%s</td><td>%s</td><td>",
-                              webkit_mime_info_get_mime_type (mime_info),
-                              webkit_mime_info_get_description (mime_info));
-
-      extensions = webkit_mime_info_get_extensions (mime_info);
-      for (i = 0; extensions && extensions[i] != NULL; i++)
-        g_string_append_printf (data_str, "%s%c", extensions[i],
-                                extensions[i + 1] ? ',' : ' ');
-
-      g_string_append (data_str, "</td></tr>");
-    }
-
-    g_string_append (data_str, "</tbody></table>");
-  }
-  g_string_append (data_str, "</body></html>");
-
-  g_list_free_full (plugin_list, g_object_unref);
-
-  data_length = data_str->len;
-  ephy_about_handler_finish_request (about_request->request, g_string_free (data_str, FALSE), data_length);
-  ephy_about_request_free (about_request);
-}
-
-static gboolean
-ephy_about_handler_handle_plugins (EphyAboutHandler       *handler,
-                                   WebKitURISchemeRequest *request)
-{
-  EphyEmbedShell *shell = ephy_embed_shell_get_default ();
-
-  webkit_web_context_get_plugins (ephy_embed_shell_get_web_context (shell),
-                                  NULL,
-                                  (GAsyncReadyCallback)get_plugins_cb,
-                                  ephy_about_request_new (handler, request));
-
-  return TRUE;
-}
-
-static void
 handle_memory_finished_cb (EphyAboutHandler       *handler,
                            GAsyncResult           *result,
                            WebKitURISchemeRequest *request)
@@ -632,9 +551,7 @@ ephy_about_handler_handle_request (EphyAboutHandler       *handler,
 
   path = webkit_uri_scheme_request_get_path (request);
 
-  if (!g_strcmp0 (path, "plugins"))
-    handled = ephy_about_handler_handle_plugins (handler, request);
-  else if (!g_strcmp0 (path, "memory"))
+  if (!g_strcmp0 (path, "memory"))
     handled = ephy_about_handler_handle_memory (handler, request);
   else if (!g_strcmp0 (path, "epiphany"))
     handled = ephy_about_handler_handle_epiphany (handler, request);
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index bbcd624..2144bea 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -552,6 +552,7 @@ ephy_embed_prefs_init (gpointer user_data)
   webkit_settings = webkit_settings_new_with_settings ("enable-developer-extras", TRUE,
                                                        "enable-fullscreen", TRUE,
                                                        "enable-javascript", TRUE,
+                                                       "enable-plugins", FALSE,
                                                        "enable-site-specific-quirks", TRUE,
                                                        "enable-dns-prefetching", TRUE,
                                                        "javascript-can-open-windows-automatically", TRUE,
@@ -589,10 +590,6 @@ ephy_embed_prefs_init (gpointer user_data)
                    webkit_settings, "enable-caret-browsing",
                    G_SETTINGS_BIND_GET);
   g_settings_bind (EPHY_SETTINGS_WEB,
-                   EPHY_PREFS_WEB_ENABLE_PLUGINS,
-                   webkit_settings, "enable-plugins",
-                   G_SETTINGS_BIND_GET);
-  g_settings_bind (EPHY_SETTINGS_WEB,
                    EPHY_PREFS_WEB_FONT_MIN_SIZE,
                    webkit_settings, "minimum-font-size",
                    G_SETTINGS_BIND_GET);
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index b86db28..14449c7 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -86,7 +86,6 @@ typedef enum
 #define EPHY_PREFS_WEB_USE_OWN_COLORS        "use-own-colors"
 #define EPHY_PREFS_WEB_ENABLE_USER_CSS       "enable-user-css"
 #define EPHY_PREFS_WEB_ENABLE_POPUPS         "enable-popups"
-#define EPHY_PREFS_WEB_ENABLE_PLUGINS        "enable-plugins"
 #define EPHY_PREFS_WEB_ENABLE_SPELL_CHECKING "enable-spell-checking"
 #define EPHY_PREFS_WEB_ENABLE_WEBGL          "enable-webgl"
 #define EPHY_PREFS_WEB_ENABLE_WEBAUDIO       "enable-webaudio"
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 2d7e809..0f08016 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -69,7 +69,6 @@ struct _PrefsDialog {
   GtkWidget *restore_session_checkbutton;
   GtkWidget *popups_allow_checkbutton;
   GtkWidget *adblock_allow_checkbutton;
-  GtkWidget *enable_plugins_checkbutton;
 
   /* fonts */
   GtkWidget *use_gnome_fonts_checkbutton;
@@ -522,7 +521,6 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, restore_session_checkbutton);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, popups_allow_checkbutton);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, adblock_allow_checkbutton);
-  gtk_widget_class_bind_template_child (widget_class, PrefsDialog, enable_plugins_checkbutton);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, download_button_hbox);
   gtk_widget_class_bind_template_child (widget_class, PrefsDialog, download_button_label);
 
@@ -1423,11 +1421,6 @@ setup_general_page (PrefsDialog *dialog)
                    dialog->adblock_allow_checkbutton,
                    "active",
                    G_SETTINGS_BIND_INVERT_BOOLEAN);
-  g_settings_bind (web_settings,
-                   EPHY_PREFS_WEB_ENABLE_PLUGINS,
-                   dialog->enable_plugins_checkbutton,
-                   "active",
-                   G_SETTINGS_BIND_DEFAULT);
 
   create_download_path_button (dialog);
   create_search_engine_combo (GTK_COMBO_BOX (dialog->search_engine_combo));
diff --git a/src/resources/prefs-dialog.ui b/src/resources/prefs-dialog.ui
index 4a63db3..838eee6 100644
--- a/src/resources/prefs-dialog.ui
+++ b/src/resources/prefs-dialog.ui
@@ -211,13 +211,6 @@
                             <property name="use-underline">True</property>
                           </object>
                         </child>
-                        <child>
-                          <object class="GtkCheckButton" id="enable_plugins_checkbutton">
-                            <property name="label" translatable="yes">Enable _plugins</property>
-                            <property name="visible">True</property>
-                            <property name="use-underline">True</property>
-                          </object>
-                        </child>
                       </object>
                     </child>
                   </object>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]