[epiphany/gnome-3-30] Don't show reader mode on internal pages



commit c57934f6f3f1b8d4446fd384ff81eca36f43e9c5
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Sep 18 20:23:39 2018 -0500

    Don't show reader mode on internal pages
    
    E.g. the incognito mode welcome screen shouldn't offer reader mode

 embed/ephy-web-view.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 3c4a183f2..191599f29 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1036,16 +1036,19 @@ readability_js_finish_cb (GObject      *object,
 }
 
 static gboolean
-run_readability_js (gpointer data)
+run_readability_js_if_needed (gpointer data)
 {
   EphyWebView *web_view = data;
 
-  web_view->reader_js_timeout = 0;
-  webkit_web_view_run_javascript_from_gresource (WEBKIT_WEB_VIEW (web_view),
-                                                 "/org/gnome/epiphany/readability.js",
-                                                 NULL,
-                                                 readability_js_finish_cb,
-                                                 web_view);
+  /* Internal pages should never receive reader mode. */
+  if (!ephy_embed_utils_is_no_show_address (web_view->address)) {
+    web_view->reader_js_timeout = 0;
+    webkit_web_view_run_javascript_from_gresource (WEBKIT_WEB_VIEW (web_view),
+                                                   "/org/gnome/epiphany/readability.js",
+                                                   NULL,
+                                                   readability_js_finish_cb,
+                                                   web_view);
+  }
 
   return G_SOURCE_REMOVE;
 }
@@ -1972,7 +1975,7 @@ load_changed_cb (WebKitWebView  *web_view,
 
       view->reader_loading = FALSE;
       if (!view->reader_active)
-        view->reader_js_timeout = g_idle_add (run_readability_js, web_view);
+        view->reader_js_timeout = g_idle_add (run_readability_js_if_needed, web_view);
 
       break;
 


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