Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package epiphany for openSUSE:Factory 
checked in at 2021-08-24 10:54:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/epiphany (Old)
 and      /work/SRC/openSUSE:Factory/.epiphany.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "epiphany"

Tue Aug 24 10:54:37 2021 rev:183 rq:913681 version:40.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/epiphany/epiphany.changes        2021-06-05 
23:32:04.348494345 +0200
+++ /work/SRC/openSUSE:Factory/.epiphany.new.1899/epiphany.changes      
2021-08-24 10:55:27.816274001 +0200
@@ -1,0 +2,10 @@
+Fri Aug 13 09:38:48 UTC 2021 - Bj??rn Lie <bjorn....@gmail.com>
+
+- Update to version 40.3:
+  + Use PDF.js only for GET requests
+  + Use AdGuard script to block YouTube ads
+  + Manually check adblock filter content type
+  + Fix UI process CPU usage issue
+  + Don't improperly lowercase bang searches
+
+-------------------------------------------------------------------

Old:
----
  epiphany-40.2.tar.xz

New:
----
  epiphany-40.3.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ epiphany.spec ++++++
--- /var/tmp/diff_new_pack.Qxk9VA/_old  2021-08-24 10:55:28.364273275 +0200
+++ /var/tmp/diff_new_pack.Qxk9VA/_new  2021-08-24 10:55:28.368273270 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           epiphany
-Version:        40.2
+Version:        40.3
 Release:        0
 Summary:        GNOME Web Browser
 License:        GPL-3.0-or-later

++++++ epiphany-40.2.tar.xz -> epiphany-40.3.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/NEWS new/epiphany-40.3/NEWS
--- old/epiphany-40.2/NEWS      2021-06-04 16:41:43.520401000 +0200
+++ new/epiphany-40.3/NEWS      2021-08-12 21:31:10.163083300 +0200
@@ -1,3 +1,12 @@
+40.3 - August 12, 2021
+======================
+
+ * Use PDF.js only for GET requests (#1505)
+ * Use AdGuard script to block YouTube ads (#1534)
+ * Manually check adblock filter content type (#1543)
+ * Fix UI process CPU usage issue (#1560)
+ * Don't improperly lowercase bang searches (!988, Vanadiae)
+
 40.2 - June 4, 2021
 ===================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/epiphany-40.2/data/org.gnome.Epiphany.appdata.xml.in.in 
new/epiphany-40.3/data/org.gnome.Epiphany.appdata.xml.in.in
--- old/epiphany-40.2/data/org.gnome.Epiphany.appdata.xml.in.in 2021-06-04 
16:41:43.521401200 +0200
+++ new/epiphany-40.3/data/org.gnome.Epiphany.appdata.xml.in.in 2021-08-12 
21:31:10.165083200 +0200
@@ -48,6 +48,7 @@
     <value key="Purism::form_factor">mobile</value>
   </custom>
   <releases>
+    <release date="2021-08-12" version="40.3"/>
     <release date="2021-06-04" version="40.2"/>
     <release date="2021-04-29" version="40.1"/>
     <release date="2021-03-19" version="40.0"/>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/embed/ephy-embed-utils.c 
new/epiphany-40.3/embed/ephy-embed-utils.c
--- old/epiphany-40.2/embed/ephy-embed-utils.c  2021-06-04 16:41:43.525401000 
+0200
+++ new/epiphany-40.3/embed/ephy-embed-utils.c  2021-08-12 21:31:10.170083500 
+0200
@@ -260,23 +260,46 @@
   return retval;
 }
 
+static char *
+ensure_host_name_is_lowercase (const char *address)
+{
+  g_autofree gchar *host = ephy_string_get_host_name (address);
+  g_autofree gchar *lowercase_host = NULL;
+
+  if (!host)
+    return g_strdup (address);
+
+  lowercase_host = g_utf8_strdown (host, -1);
+
+  if (strcmp (host, lowercase_host) != 0)
+    return ephy_string_find_and_replace (address, host, lowercase_host);
+  else
+    return g_strdup (address);
+}
+
 char *
-ephy_embed_utils_normalize_address (const char *address)
+ephy_embed_utils_normalize_address (const char *input_address)
 {
   char *effective_address = NULL;
+  g_autofree gchar *address = NULL;
 
-  g_assert (address);
-
-  if (is_bang_search (address)) {
+  g_assert (input_address);
+  /* We don't want to lowercase the host name if it's a bang search, as it's 
not a URI.
+   * It would otherwise lowercase the entire search string, bang included, 
which is not
+   * what we want. So use input_address directly.
+   */
+  if (is_bang_search (input_address)) {
     EphyEmbedShell *shell;
     EphySearchEngineManager *search_engine_manager;
 
     shell = ephy_embed_shell_get_default ();
     search_engine_manager = ephy_embed_shell_get_search_engine_manager (shell);
     return ephy_search_engine_manager_parse_bang_search (search_engine_manager,
-                                                         address);
+                                                         input_address);
   }
 
+  address = ensure_host_name_is_lowercase (input_address);
+
   if (ephy_embed_utils_address_is_existing_absolute_filename (address))
     return g_strconcat ("file://", address, NULL);
 
@@ -337,35 +360,11 @@
   return effective_address;
 }
 
-static char *
-ensure_host_name_is_lowercase (const char *address)
-{
-  g_autofree gchar *host = ephy_string_get_host_name (address);
-  g_autofree gchar *lowercase_host = NULL;
-  char *ret = NULL;
-
-  if (host == NULL) {
-    return g_strdup (address);
-  }
-
-  lowercase_host = g_utf8_strdown (host, -1);
-
-  if (strcmp (host, lowercase_host) != 0) {
-    ret = ephy_string_find_and_replace (address, host, lowercase_host);
-  } else {
-    ret = g_strdup (address);
-  }
-
-  return ret;
-}
-
 char *
 ephy_embed_utils_normalize_or_autosearch_address (const char *address)
 {
-  g_autofree gchar *lower_case_address = ensure_host_name_is_lowercase 
(address);
-
-  if (ephy_embed_utils_address_is_valid (lower_case_address))
-    return ephy_embed_utils_normalize_address (lower_case_address);
+  if (ephy_embed_utils_address_is_valid (address))
+    return ephy_embed_utils_normalize_address (address);
   else
     return ephy_embed_utils_autosearch_address (address);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/embed/ephy-filters-manager.c 
new/epiphany-40.3/embed/ephy-filters-manager.c
--- old/epiphany-40.2/embed/ephy-filters-manager.c      2021-06-04 
16:41:43.526401300 +0200
+++ new/epiphany-40.3/embed/ephy-filters-manager.c      2021-08-12 
21:31:10.172083400 +0200
@@ -571,9 +571,59 @@
 }
 
 static void
+json_file_deleted (GObject      *source,
+                   GAsyncResult *res,
+                   gpointer      user_data)
+{
+  g_autoptr (GError) error = NULL;
+  if (!g_file_delete_finish (G_FILE (source), res, &error))
+    g_warning ("Could not delete filter json file: %s", error->message);
+}
+
+typedef struct {
+  EphyDownload *download;
+  FilterInfo *self;
+} FilterJsonInfoAsyncData;
+
+static void
+json_file_info_callback (GObject      *source_object,
+                         GAsyncResult *res,
+                         gpointer      user_data)
+{
+  g_autoptr (GError) error = NULL;
+  FilterJsonInfoAsyncData *data = user_data;
+  GFile *json_file = G_FILE (source_object);
+  g_autoptr (GFileInfo) info = g_file_query_info_finish (json_file, res, 
&error);
+  const char *content_type = NULL;
+
+  if (info)
+    content_type = g_file_info_get_content_type (info);
+  else
+    g_warning ("Couldn't query filter file %s: %s", 
ephy_download_get_destination_uri (data->download), error->message);
+
+  if (content_type && g_strcmp0 ("application/json", content_type) == 0) {
+    filter_info_setup_load_file (data->self, json_file);
+  } else {
+    g_warning ("Filter source %s has invalid MIME type: %s",
+               ephy_download_get_destination_uri (data->download),
+               content_type);
+
+    g_file_delete_async (json_file, G_PRIORITY_DEFAULT, NULL, 
json_file_deleted, NULL);
+
+    filter_info_setup_done (data->self);
+  }
+
+  g_object_unref (data->download);
+  g_free (data);
+}
+
+static void
 download_completed_cb (EphyDownload *download,
                        FilterInfo   *self)
 {
+  g_autoptr (GFile) json_file = NULL;
+  FilterJsonInfoAsyncData *data = NULL;
+
   g_assert (download);
   g_assert (self);
 
@@ -581,17 +631,18 @@
 
   LOG ("Filter source %s fetched from <%s>", filter_info_get_identifier 
(self), self->source_uri);
 
-  if (g_strcmp0 ("application/json", ephy_download_get_content_type 
(download)) == 0) {
-    g_autoptr (GFile) json_file = g_file_new_for_uri 
(ephy_download_get_destination_uri (download));
-    filter_info_setup_load_file (self, json_file);
-  } else {
-    g_warning ("Filter source %s has invalid MIME type: %s",
-               ephy_download_get_destination_uri (download),
-               ephy_download_get_content_type (download));
-    filter_info_setup_done (self);
-  }
-
-  g_object_unref (download);
+  data = g_new0 (FilterJsonInfoAsyncData, 1);
+  data->download = download;
+  data->self = self;
+
+  json_file = g_file_new_for_uri (ephy_download_get_destination_uri 
(download));
+  g_file_query_info_async (json_file,
+                           G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+                           G_FILE_QUERY_INFO_NONE,
+                           G_PRIORITY_DEFAULT,
+                           NULL,
+                           json_file_info_callback,
+                           data);
 }
 
 static void
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/embed/ephy-web-view.c 
new/epiphany-40.3/embed/ephy-web-view.c
--- old/epiphany-40.2/embed/ephy-web-view.c     2021-06-04 16:41:43.528401100 
+0200
+++ new/epiphany-40.3/embed/ephy-web-view.c     2021-08-12 21:31:10.174083500 
+0200
@@ -873,6 +873,8 @@
 
   /* If it's not the main resource, we don't need to set the document type. */
   if (is_main_resource) {
+    const char *method = webkit_uri_request_get_http_method (request);
+
     type = EPHY_WEB_VIEW_DOCUMENT_OTHER;
     if (strcmp (mime_type, "text/html") == 0 || strcmp (mime_type, 
"text/plain") == 0) {
       type = EPHY_WEB_VIEW_DOCUMENT_HTML;
@@ -880,7 +882,7 @@
       type = EPHY_WEB_VIEW_DOCUMENT_XML;
     } else if (strncmp (mime_type, "image/", 6) == 0) {
       type = EPHY_WEB_VIEW_DOCUMENT_IMAGE;
-    } else if (strcmp (mime_type, "application/pdf") == 0) {
+    } else if (strcmp (mime_type, "application/pdf") == 0 && strcmp (method, 
"GET") == 0) {
       g_autofree char *pdf_uri = NULL;
 
       /* FIXME: figure out how to make PDFs work in iframes. */
@@ -4146,6 +4148,32 @@
                 0);
 }
 
+static void
+ephy_web_view_ucm_add_custom_scripts (WebKitUserContentManager *ucm)
+{
+  WebKitUserScript *script;
+  g_autoptr (GBytes) youtube_js = NULL;
+  g_auto (GStrv) allow_list = NULL;
+  g_autoptr (GError) error = NULL;
+
+  youtube_js = g_resources_lookup_data 
("/org/gnome/epiphany/adguard/youtube.js", 0, &error);
+  if (!youtube_js) {
+    g_warning ("Failed to load youtube.js from AdGuard: %s", error->message);
+    return;
+  }
+
+  allow_list = g_new (char *, 2);
+  allow_list[0] = g_strdup ("https://*.youtube.com/*";);
+  allow_list[1] = NULL;
+
+  script = webkit_user_script_new (g_bytes_get_data (youtube_js, NULL),
+                                   WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES,
+                                   WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END,
+                                   (const char * const *)allow_list,
+                                   NULL);
+  webkit_user_content_manager_add_script (ucm, script);
+}
+
 /**
  * ephy_web_view_new:
  *
@@ -4163,6 +4191,8 @@
   ephy_embed_shell_register_ucm_handler (shell, ucm);
   ephy_embed_prefs_register_ucm (ucm);
 
+  ephy_web_view_ucm_add_custom_scripts (ucm);
+
   return g_object_new (EPHY_TYPE_WEB_VIEW,
                        "web-context", ephy_embed_shell_get_web_context (shell),
                        "user-content-manager", ucm,
@@ -4177,6 +4207,8 @@
   EphyEmbedShell *shell = ephy_embed_shell_get_default ();
   WebKitUserContentManager *ucm = webkit_user_content_manager_new ();
 
+  ephy_web_view_ucm_add_custom_scripts (ucm);
+
   ephy_embed_shell_register_ucm_handler (shell, ucm);
   ephy_embed_prefs_register_ucm (ucm);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/meson.build 
new/epiphany-40.3/meson.build
--- old/epiphany-40.2/meson.build       2021-06-04 16:41:43.555401800 +0200
+++ new/epiphany-40.3/meson.build       2021-08-12 21:31:10.200084200 +0200
@@ -1,6 +1,6 @@
 project('epiphany', 'c',
   license: 'GPL3+',
-  version: '40.2',
+  version: '40.3',
   meson_version: '>= 0.47.0',
   default_options: ['c_std=gnu11',
                     'warning_level=2']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/po/pt.po new/epiphany-40.3/po/pt.po
--- old/epiphany-40.2/po/pt.po  2021-06-04 16:41:43.609403100 +0200
+++ new/epiphany-40.3/po/pt.po  2021-08-12 21:31:10.257085600 +0200
@@ -7,26 +7,31 @@
 # Pedro Albuquerque <palbuquerqu...@gmail.com>, 2015.
 # S??rgio Cardeira <cardeira.ser...@gmail.com>, 2016.
 # Tiago Carrrondo <tcarro...@ubuntu.com>, 2016.
-# Juliano de Souza Camargo <julian...@protonmail.com>, 2020.
 # Hugo Carvalho <hugokarva...@hotmail.com>, 2020.
+# Juliano de Souza Camargo <julian...@protonmail.com>, 2020-2021.
 #
 msgid ""
 msgstr ""
 "Project-Id-Version: 3.22\n"
 "Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/epiphany/issues\n";
-"POT-Creation-Date: 2021-03-29 22:19+0000\n"
-"PO-Revision-Date: 2021-03-30 10:41+0100\n"
-"Last-Translator: Hugo Carvalho <hugokarva...@hotmail.com>\n"
-"Language-Team: Portuguese <https://l10n.gnome.org/teams/pt/>\n"
+"POT-Creation-Date: 2021-06-04 14:43+0000\n"
+"PO-Revision-Date: 2021-06-12 09:20-0300\n"
+"Last-Translator: Juliano de Souza Camargo <julian...@protonmail.com>\n"
+"Language-Team: Portuguese < >\n"
 "Language: pt\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: Poedit 2.4.2\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"X-Generator: Gtranslator 40.0\n"
 "X-DamnedLies-Scope: partial\n"
 "X-Language: pt_PT\n"
 "X-Source-Language: C\n"
+"X-DL-Team: pt\n"
+"X-DL-Module: epiphany\n"
+"X-DL-Branch: gnome-40\n"
+"X-DL-Domain: po\n"
+"X-DL-State: Translating\n"
 
 #: data/org.gnome.Epiphany.appdata.xml.in.in:6
 msgid "GNOME Web"
@@ -61,7 +66,7 @@
 
 #: data/org.gnome.Epiphany.desktop.in.in:3 embed/ephy-about-handler.c:192
 #: embed/ephy-about-handler.c:226 src/ephy-main.c:102 src/ephy-main.c:254
-#: src/ephy-main.c:406 src/window-commands.c:1009
+#: src/ephy-main.c:406 src/window-commands.c:1011
 msgid "Web"
 msgstr "Web"
 
@@ -995,7 +1000,7 @@
 msgid "About Web"
 msgstr "Acerca do Web"
 
-#: embed/ephy-about-handler.c:194 src/window-commands.c:1011
+#: embed/ephy-about-handler.c:194 src/window-commands.c:1013
 msgid "Epiphany Technology Preview"
 msgstr "Pr??-visualiza????o de Tecnologia Epiphany"
 
@@ -1079,7 +1084,7 @@
 #: embed/ephy-download.c:725
 #, c-format
 msgid "Finished downloading %s"
-msgstr "Erro ao transferir: %s"
+msgstr "Terminou a transfer??ncia de %s"
 
 #. Translators: the title of the notification.
 #: embed/ephy-download.c:727
@@ -1091,13 +1096,13 @@
 msgstr "Transfer??ncia requisitada"
 
 #: embed/ephy-download.c:819 lib/widgets/ephy-file-chooser.c:164
-#: src/ephy-web-extension-dialog.c:75 src/ephy-web-extension-dialog.c:242
+#: src/ephy-web-extension-dialog.c:75 src/ephy-web-extension-dialog.c:243
 #: src/resources/gtk/firefox-sync-dialog.ui:173
 #: src/resources/gtk/history-dialog.ui:96
-#: src/resources/gtk/prefs-lang-dialog.ui:16 src/window-commands.c:276
-#: src/window-commands.c:334 src/window-commands.c:378
-#: src/window-commands.c:562 src/window-commands.c:647
-#: src/window-commands.c:809 src/window-commands.c:1889
+#: src/resources/gtk/prefs-lang-dialog.ui:16 src/window-commands.c:278
+#: src/window-commands.c:336 src/window-commands.c:380
+#: src/window-commands.c:564 src/window-commands.c:649
+#: src/window-commands.c:811 src/window-commands.c:1891
 msgid "_Cancel"
 msgstr "_Cancelar"
 
@@ -1508,7 +1513,7 @@
 msgid "%s is not a valid URI"
 msgstr "%s ?? um URI inv??lido"
 
-#: embed/ephy-web-view.c:189 src/window-commands.c:1351
+#: embed/ephy-web-view.c:189 src/window-commands.c:1353
 msgid "Open"
 msgstr "Abrir"
 
@@ -1521,7 +1526,7 @@
 msgstr "_Nunca gravar"
 
 #: embed/ephy-web-view.c:370 lib/widgets/ephy-file-chooser.c:175
-#: src/resources/gtk/firefox-sync-dialog.ui:182 src/window-commands.c:646
+#: src/resources/gtk/firefox-sync-dialog.ui:182 src/window-commands.c:648
 msgid "_Save"
 msgstr "_Gravar"
 
@@ -1899,7 +1904,7 @@
 msgid "Technical information"
 msgstr "Informa????o t??cnica"
 
-#: embed/ephy-web-view.c:3463
+#: embed/ephy-web-view.c:3462
 msgid "_OK"
 msgstr "_Aceitar"
 
@@ -2245,7 +2250,7 @@
 msgid "Starting???"
 msgstr "A iniciar???"
 
-#: lib/widgets/ephy-file-chooser.c:173 src/ephy-web-extension-dialog.c:243
+#: lib/widgets/ephy-file-chooser.c:173 src/ephy-web-extension-dialog.c:242
 #: src/resources/gtk/history-dialog.ui:277
 msgid "_Open"
 msgstr "_Abrir"
@@ -2441,7 +2446,7 @@
 msgid "Reload the current page"
 msgstr "Recarregar a p??gina atual"
 
-#: src/ephy-action-bar-start.c:646 src/ephy-header-bar.c:475
+#: src/ephy-action-bar-start.c:643 src/ephy-header-bar.c:474
 msgid "Stop loading the current page"
 msgstr "Parar carregamento da p??gina atual"
 
@@ -2569,11 +2574,11 @@
 msgid "Do you want to leave this website?"
 msgstr "Deseja deixar este website?"
 
-#: src/ephy-window.c:283 src/window-commands.c:1199
+#: src/ephy-window.c:283 src/window-commands.c:1201
 msgid "A form you modified has not been submitted."
 msgstr "Um formulado alterado por si n??o foi enviado."
 
-#: src/ephy-window.c:284 src/window-commands.c:1201
+#: src/ephy-window.c:284 src/window-commands.c:1203
 msgid "_Discard form"
 msgstr "_Descartar formul??rio"
 
@@ -2740,15 +2745,15 @@
 msgid "Open Link In Incognito Window"
 msgstr "Abrir liga????o em janela inc??gnita"
 
-#: src/ephy-window.c:2885
+#: src/ephy-window.c:2872
 msgid "Download operation"
 msgstr "Transfer??ncias"
 
-#: src/ephy-window.c:2887
+#: src/ephy-window.c:2874
 msgid "Show details"
 msgstr "Mostrar detalhes"
 
-#: src/ephy-window.c:2889
+#: src/ephy-window.c:2876
 #, c-format
 msgid "%d download operation active"
 msgid_plural "%d download operations active"
@@ -2756,25 +2761,25 @@
 msgstr[1] "%d transfer??ncias ativas"
 
 #. Translators: tooltip for the tab switcher menu button
-#: src/ephy-window.c:3407
+#: src/ephy-window.c:3394
 msgid "View open tabs"
 msgstr "Ver separadores abertos"
 
-#: src/ephy-window.c:3538
+#: src/ephy-window.c:3525
 msgid "Set Web as your default browser?"
 msgstr "Definir o Web como navegador principal?"
 
-#: src/ephy-window.c:3540
+#: src/ephy-window.c:3527
 msgid "Set Epiphany Technology Preview as your default browser?"
 msgstr ""
 "Definir a Pr??-visualiza????o de Tecnologia Epiphany como seu navegador "
 "principal?"
 
-#: src/ephy-window.c:3552
+#: src/ephy-window.c:3539
 msgid "_Yes"
 msgstr "_Sim"
 
-#: src/ephy-window.c:3553
+#: src/ephy-window.c:3540
 msgid "_No"
 msgstr "_N??o"
 
@@ -3974,70 +3979,70 @@
 msgid "Firefox"
 msgstr "Firefox"
 
-#: src/window-commands.c:117 src/window-commands.c:697
+#: src/window-commands.c:117 src/window-commands.c:699
 msgid "Chrome"
 msgstr "Chrome"
 
-#: src/window-commands.c:118 src/window-commands.c:698
+#: src/window-commands.c:118 src/window-commands.c:700
 msgid "Chromium"
 msgstr "Chromium"
 
-#: src/window-commands.c:132 src/window-commands.c:564
-#: src/window-commands.c:783
+#: src/window-commands.c:132 src/window-commands.c:566
+#: src/window-commands.c:785
 msgid "Ch_oose File"
 msgstr "E_scolher ficheiro"
 
-#: src/window-commands.c:134 src/window-commands.c:333
-#: src/window-commands.c:377 src/window-commands.c:785
-#: src/window-commands.c:811
+#: src/window-commands.c:134 src/window-commands.c:335
+#: src/window-commands.c:379 src/window-commands.c:787
+#: src/window-commands.c:813
 msgid "I_mport"
 msgstr "I_mportar"
 
-#: src/window-commands.c:273
+#: src/window-commands.c:275
 msgid "Select Profile"
 msgstr "Selecionar perfil"
 
-#: src/window-commands.c:278
+#: src/window-commands.c:280
 msgid "_Select"
 msgstr "_Selecionar"
 
-#: src/window-commands.c:330 src/window-commands.c:374
-#: src/window-commands.c:643
+#: src/window-commands.c:332 src/window-commands.c:376
+#: src/window-commands.c:645
 msgid "Choose File"
 msgstr "Escolher ficheiro"
 
-#: src/window-commands.c:355 src/window-commands.c:399
-#: src/window-commands.c:446 src/window-commands.c:471
-#: src/window-commands.c:496
+#: src/window-commands.c:357 src/window-commands.c:401
+#: src/window-commands.c:448 src/window-commands.c:473
+#: src/window-commands.c:498
 msgid "Bookmarks successfully imported!"
 msgstr "Marcadores importados com sucesso!"
 
-#: src/window-commands.c:559
+#: src/window-commands.c:561
 msgid "Import Bookmarks"
 msgstr "Importar marcadores"
 
-#: src/window-commands.c:577 src/window-commands.c:824
+#: src/window-commands.c:579 src/window-commands.c:826
 msgid "From:"
 msgstr "De:"
 
-#: src/window-commands.c:623
+#: src/window-commands.c:625
 msgid "Bookmarks successfully exported!"
 msgstr "Marcadores exportados com sucesso!"
 
 #. Translators: Only translate the part before ".html" (e.g. "bookmarks")
-#: src/window-commands.c:651
+#: src/window-commands.c:653
 msgid "bookmarks.html"
 msgstr "marcadores.html"
 
-#: src/window-commands.c:739
+#: src/window-commands.c:741
 msgid "Passwords successfully imported!"
 msgstr "Palavras-passe importadas com sucesso!"
 
-#: src/window-commands.c:806
+#: src/window-commands.c:808
 msgid "Import Passwords"
 msgstr "Importar palavras-passe"
 
-#: src/window-commands.c:997
+#: src/window-commands.c:999
 #, c-format
 msgid ""
 "A simple, clean, beautiful view of the web.\n"
@@ -4046,11 +4051,11 @@
 "Uma vista simples, limpa e linda da Web.\n"
 "Suportada pelo WebKit %d.%d.%d"
 
-#: src/window-commands.c:1021
+#: src/window-commands.c:1023
 msgid "Website"
 msgstr "P??gina Web"
 
-#: src/window-commands.c:1054
+#: src/window-commands.c:1056
 msgid "translator-credits"
 msgstr ""
 "Duarte Loreto <happyguy...@hotmail.com>\n"
@@ -4059,75 +4064,75 @@
 "Juliano de Souza Camargo <julian...@pm.me>\n"
 "Hugo Carvalho <hugokarva...@hotmail.com>"
 
-#: src/window-commands.c:1197
+#: src/window-commands.c:1199
 msgid "Do you want to reload this website?"
 msgstr "Deseja recarregar este s??tio Web?"
 
-#: src/window-commands.c:1726
+#: src/window-commands.c:1728
 #, c-format
 msgid "A web application named ???%s??? already exists. Do you want to replace 
it?"
 msgstr "J?? existe uma aplica????o Web designada ???%s???. Deseja 
substitu??-la?"
 
-#: src/window-commands.c:1729
+#: src/window-commands.c:1731
 msgid "Cancel"
 msgstr "Cancelar"
 
-#: src/window-commands.c:1731
+#: src/window-commands.c:1733
 msgid "Replace"
 msgstr "Substituir"
 
-#: src/window-commands.c:1735
+#: src/window-commands.c:1737
 msgid ""
 "An application with the same name already exists. Replacing it will "
 "overwrite it."
 msgstr ""
 "J?? existe uma aplica????o com o mesmo nome. Substitu??-la ir?? 
sobrescrev??-la."
 
-#: src/window-commands.c:1827
+#: src/window-commands.c:1829
 #, c-format
 msgid "The application ???%s??? is ready to be used"
 msgstr "A aplica????o ???%s??? est?? pronta a ser utilizada"
 
-#: src/window-commands.c:1830
+#: src/window-commands.c:1832
 #, c-format
 msgid "The application ???%s??? could not be created"
 msgstr "Imposs??vel criar a aplica????o ???%s???"
 
 #. Translators: Desktop notification when a new web app is created.
-#: src/window-commands.c:1845
+#: src/window-commands.c:1847
 msgid "Launch"
 msgstr "Iniciar"
 
 #. Show dialog with icon, title.
-#: src/window-commands.c:1886
+#: src/window-commands.c:1888
 msgid "Create Web Application"
 msgstr "Criar aplica????o Web"
 
-#: src/window-commands.c:1891
+#: src/window-commands.c:1893
 msgid "C_reate"
 msgstr "C_riar"
 
-#: src/window-commands.c:2106
+#: src/window-commands.c:2108
 msgid "Save"
 msgstr "Gravar"
 
-#: src/window-commands.c:2115
+#: src/window-commands.c:2117
 msgid "HTML"
 msgstr "HTML"
 
-#: src/window-commands.c:2120
+#: src/window-commands.c:2122
 msgid "MHTML"
 msgstr "MHTML"
 
-#: src/window-commands.c:2125
+#: src/window-commands.c:2127
 msgid "PNG"
 msgstr "PNG"
 
-#: src/window-commands.c:2610
+#: src/window-commands.c:2612
 msgid "Enable caret browsing mode?"
 msgstr "Ativar o modo de navega????o com cursor?"
 
-#: src/window-commands.c:2613
+#: src/window-commands.c:2615
 msgid ""
 "Pressing F7 turns caret browsing on or off. This feature places a moveable "
 "cursor in web pages, allowing you to move around with your keyboard. Do you "
@@ -4137,7 +4142,7 @@
 "cursor m??vel nas p??ginas web, permitindo-lhe que se desloque com o teclado. 
"
 "Quer ativar a navega????o com cursor?"
 
-#: src/window-commands.c:2616
+#: src/window-commands.c:2618
 msgid "_Enable"
 msgstr "_Ativar"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/src/ephy-window.c 
new/epiphany-40.3/src/ephy-window.c
--- old/epiphany-40.2/src/ephy-window.c 2021-06-04 16:41:43.630403800 +0200
+++ new/epiphany-40.3/src/ephy-window.c 2021-08-12 21:31:10.276086000 +0200
@@ -170,6 +170,7 @@
   guint modified_forms_timeout_id;
   EphyMouseGestureController *mouse_gesture_controller;
   EphyEmbed *last_opened_embed;
+  EphyAdaptiveMode adaptive_mode;
   int last_opened_pos;
   gboolean show_fullscreen_header_bar;
 
@@ -548,6 +549,12 @@
   adaptive_mode = (is_narrow || is_mobile_landscape) && !is_desktop_pantheon 
() ?
                   EPHY_ADAPTIVE_MODE_NARROW :
                   EPHY_ADAPTIVE_MODE_NORMAL;
+
+  if (window->adaptive_mode == adaptive_mode)
+    return;
+
+  window->adaptive_mode = adaptive_mode;
+
   ephy_header_bar_set_adaptive_mode (header_bar, adaptive_mode);
   ephy_action_bar_set_adaptive_mode (action_bar, adaptive_mode);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/src/meson.build 
new/epiphany-40.3/src/meson.build
--- old/epiphany-40.2/src/meson.build   2021-06-04 16:41:43.630403800 +0200
+++ new/epiphany-40.3/src/meson.build   2021-08-12 21:31:10.277086000 +0200
@@ -146,6 +146,7 @@
   pdfjs_resources,
   highlightjs_resources,
   readability_resources,
+  adguard_resources
 ]
 
 epiphany = executable('epiphany',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/tests/meson.build 
new/epiphany-40.3/tests/meson.build
--- old/epiphany-40.2/tests/meson.build 2021-06-04 16:41:43.640404000 +0200
+++ new/epiphany-40.3/tests/meson.build 2021-08-12 21:31:10.286086300 +0200
@@ -33,6 +33,7 @@
 
   embed_shell_test = executable('test-ephy-embed-shell',
     'ephy-embed-shell-test.c',
+    adguard_resources,
     dependencies: ephymain_dep,
     c_args: test_cargs + ['-DTEST_DIR="' + meson.current_source_dir() + '"'],
   )
@@ -172,6 +173,7 @@
     'ephy-web-view-test.c',
     resources,
     readability_resources,
+    adguard_resources,
     dependencies: ephymain_dep
   )
   test('Web view test',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/third-party/adguard/README.epiphany.md 
new/epiphany-40.3/third-party/adguard/README.epiphany.md
--- old/epiphany-40.2/third-party/adguard/README.epiphany.md    1970-01-01 
01:00:00.000000000 +0100
+++ new/epiphany-40.3/third-party/adguard/README.epiphany.md    2021-08-12 
21:31:10.286086300 +0200
@@ -0,0 +1,10 @@
+# AdGuard
+
+This directory contains an official BlockYouTubeAdsShortcut version, 
distributed at: https://github.com/AdguardTeam/BlockYouTubeAdsShortcut/
+
+## Update process
+1. Download 
https://github.com/AdguardTeam/BlockYouTubeAdsShortcut/blob/master/index.js as 
youtube.js
+2. Debrand script as requested by AdguardTeam. Comment the following line 
within the script:
+    logo.innerHTML = '__logo_text__';
+
+   Currently at line 393.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/epiphany-40.2/third-party/adguard/adguard.gresource.xml 
new/epiphany-40.3/third-party/adguard/adguard.gresource.xml
--- old/epiphany-40.2/third-party/adguard/adguard.gresource.xml 1970-01-01 
01:00:00.000000000 +0100
+++ new/epiphany-40.3/third-party/adguard/adguard.gresource.xml 2021-08-12 
21:31:10.286086300 +0200
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+       <gresource prefix="/org/gnome/epiphany/adguard">
+               <file compressed="true">youtube.js</file>
+       </gresource>
+</gresources>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/third-party/adguard/youtube.js 
new/epiphany-40.3/third-party/adguard/youtube.js
--- old/epiphany-40.2/third-party/adguard/youtube.js    1970-01-01 
01:00:00.000000000 +0100
+++ new/epiphany-40.3/third-party/adguard/youtube.js    2021-08-12 
21:31:10.286086300 +0200
@@ -0,0 +1,466 @@
+/**
+ * This file is part of AdGuard's Block YouTube Ads 
(https://github.com/AdguardTeam/BlockYouTubeAdsShortcut).
+ *
+ * AdGuard's Block YouTube Ads 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * AdGuard's Block YouTube Ads 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 AdGuard's Block YouTube Ads.  If not, see 
<http://www.gnu.org/licenses/>.
+ */
+
+/* global Response, window, navigator, document, MutationObserver, completion 
*/
+
+/**
+ * The function that implements all the logic.
+ * Returns the run status.
+ */
+function runBlockYoutube() {
+    const locales = {
+        en: {
+            logo: 'with&nbsp;AdGuard',
+            alreadyExecuted: 'The shortcut has already been executed.',
+            wrongDomain: 'This shortcut is supposed to be launched only on 
YouTube.',
+            success: 'YouTube is now ad-free! Please note that you need to run 
this shortcut again if you reload the page.',
+        },
+        ru: {
+            logo: '??&nbsp;AdGuard',
+            alreadyExecuted: '?????????????? ?????????????? ?????? 
??????????????????.',
+            wrongDomain: '?????? ?????????????? ?????????????? 
?????????????????????????? ?????? ?????????????????????????? ???????????? ???? 
YouTube.',
+            success: '???????????? YouTube ?????? ??????????????! ??????????: 
?????? ???????????????????????? ???????????????? ?????? ?????????? ?????????? 
???????????? ?????????????????? ??????????????.',
+        },
+        es: {
+            logo: 'con&nbsp;AdGuard',
+            alreadyExecuted: 'El atajo ya ha sido ejecutado.',
+            wrongDomain: 'Se supone que este atajo se lanza s??lo en YouTube.',
+            success: '??YouTube est?? ahora libre de anuncios! Ten en cuenta 
que tienes que volver a ejecutar este atajo si recargas la p??gina.',
+        },
+        de: {
+            logo: 'mit&nbsp;AdGuard',
+            alreadyExecuted: 'Der Kurzbefehl wurde bereits ausgef??hrt.',
+            wrongDomain: 'Dieser Kurzbefehl soll nur auf YouTube gestartet 
werden.',
+            success: 'YouTube ist jetzt werbefrei! Bitte beachten Sie, dass 
Sie diesen Kurzbefehl erneut ausf??hren m??ssen, wenn Sie die Seite neu laden.',
+        },
+        fr: {
+            logo: 'avec&nbsp;AdGuard',
+            alreadyExecuted: 'Le raccourci a d??j?? ??t?? ex??cut??.',
+            wrongDomain: 'Ce raccourci est cens?? d?????tre lanc?? uniquement 
sur YouTube.',
+            success: 'YouTube est maintenant libre de pub ! Veuillez noter 
qu???il faudra r????xecuter le raccourci si vous rechargez la page.',
+        },
+        it: {
+            logo: 'con&nbsp;AdGuard',
+            alreadyExecuted: 'Il comando ?? gi?? stato eseguito.',
+            wrongDomain: 'Questa scorciatoia dovrebbe essere lanciata solo su 
YouTube.',
+            success: 'YouTube ?? ora libero da pubblicit??! Si prega di notare 
che ?? necessario eseguire nuovamente questa scorciatoia se ricarichi la 
pagina.',
+        },
+        'zh-cn': {
+            logo: '??????&nbsp;AdGuard',
+            alreadyExecuted: '????????????????????????',
+            wrongDomain: '????????????????????? YouTube ???????????????',
+            success: '???????????? YouTube 
??????????????????????????????????????????????????????????????????????????????????????????',
+        },
+        'zh-tw': {
+            logo: '??????&nbsp;AdGuard',
+            alreadyExecuted: '????????????????????????',
+            wrongDomain: '????????????????????? YouTube ???????????????',
+            success: '?????? YouTube 
?????????????????????????????????????????????????????????????????????????????????????????????',
+        },
+        ko: {
+            logo: 'AdGuard&nbsp;??????',
+            alreadyExecuted: '???????????? ?????? ?????????????????????.',
+            wrongDomain: '??? ???????????? YouTube????????? ?????? 
???????????????.',
+            success: '?????? ???????????? YouTube??? ????????? ??? 
????????????. ???????????? ???????????? ??? ??????, ??? ???????????? ?????? 
???????????? ?????????.',
+        },
+        ja: {
+            logo: 'AdGuard?????????',
+            alreadyExecuted: 
'?????????????????????????????????????????????????????????',
+            wrongDomain: 
'????????????????????????????????????YouTube?????????????????????????????????????????????????????????',
+            success: 
'YouTube???????????????????????????????????????YouTube????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????',
+        },
+        uk: {
+            logo: '??&nbsp;AdGuard',
+            alreadyExecuted: '???? ???????????? ?????????????? ?????? 
??????????????????????.',
+            wrongDomain: '???? ???????????? ?????????????? ???????? 
?????????????????? ???????? ???? YouTube.',
+            success: '?????????? YouTube ?????? ??????????????! ?????????? 
?????????? ???????????????????????????????? ???????????????? ?????????????????? 
?????????? ?????????????????? ???? ???????????? ??????????????.',
+        },
+    };
+
+    /**
+     * Gets a localized message for the specified key
+     *
+     * @param {string} key message key
+     * @returns {string} message for that key
+     */
+    const getMessage = (key) => {
+        try {
+            let locale = locales[navigator.language.toLowerCase()];
+            if (!locale) {
+                const lang = navigator.language.split('-')[0];
+                locale = locales[lang];
+            }
+            if (!locale) {
+                locale = locales.en;
+            }
+
+            return locale[key];
+        } catch (ex) {
+            return locales.en[key];
+        }
+    };
+
+    if (document.getElementById('block-youtube-ads-logo')) {
+        return {
+            success: false,
+            status: 'alreadyExecuted',
+            message: getMessage('alreadyExecuted'),
+        };
+    }
+
+    if (window.location.hostname !== 'www.youtube.com'
+        && window.location.hostname !== 'm.youtube.com'
+        && window.location.hostname !== 'music.youtube.com') {
+        return {
+            success: false,
+            status: 'wrongDomain',
+            message: getMessage('wrongDomain'),
+        };
+    }
+
+    /**
+     * Note that Shortcut scripts are executed in their own context (window)
+     * and we don't have direct access to the real page window.
+     *
+     * In order to overcome this, we add a "script" to the page which is
+     * executed in the proper context. The script content is inside
+     * the "pageScript" function.
+     */
+    const pageScript = () => {
+        const LOGO_ID = 'block-youtube-ads-logo';
+
+        const hiddenCSS = {
+            'www.youtube.com': [
+                '#__ffYoutube1',
+                '#__ffYoutube2',
+                '#__ffYoutube3',
+                '#__ffYoutube4',
+                '#feed-pyv-container',
+                '#feedmodule-PRO',
+                '#homepage-chrome-side-promo',
+                '#merch-shelf',
+                '#offer-module',
+                '#pla-shelf > ytd-pla-shelf-renderer[class="style-scope 
ytd-watch"]',
+                '#pla-shelf',
+                '#premium-yva',
+                '#promo-info',
+                '#promo-list',
+                '#promotion-shelf',
+                '#related > ytd-watch-next-secondary-results-renderer > #items 
> 
ytd-compact-promoted-video-renderer.ytd-watch-next-secondary-results-renderer',
+                '#search-pva',
+                '#shelf-pyv-container',
+                '#video-masthead',
+                '#watch-branded-actions',
+                '#watch-buy-urls',
+                '#watch-channel-brand-div',
+                '#watch7-branded-banner',
+                '#YtKevlarVisibilityIdentifier',
+                '#YtSparklesVisibilityIdentifier',
+                '.carousel-offer-url-container',
+                '.companion-ad-container',
+                '.GoogleActiveViewElement',
+                '.list-view[style="margin: 7px 0pt;"]',
+                '.promoted-sparkles-text-search-root-container',
+                '.promoted-videos',
+                '.searchView.list-view',
+                '.sparkles-light-cta',
+                '.watch-extra-info-column',
+                '.watch-extra-info-right',
+                '.ytd-carousel-ad-renderer',
+                '.ytd-compact-promoted-video-renderer',
+                '.ytd-companion-slot-renderer',
+                '.ytd-merch-shelf-renderer',
+                '.ytd-player-legacy-desktop-watch-ads-renderer',
+                '.ytd-promoted-sparkles-text-search-renderer',
+                '.ytd-promoted-video-renderer',
+                '.ytd-search-pyv-renderer',
+                '.ytd-video-masthead-ad-v3-renderer',
+                '.ytp-ad-action-interstitial-background-container',
+                '.ytp-ad-action-interstitial-slot',
+                '.ytp-ad-image-overlay',
+                '.ytp-ad-overlay-container',
+                '.ytp-ad-progress',
+                '.ytp-ad-progress-list',
+                '[class*="ytd-display-ad-"]',
+                '[layout*="display-ad-"]',
+                'a[href^="http://www.youtube.com/cthru?";]',
+                'a[href^="https://www.youtube.com/cthru?";]',
+                'ytd-action-companion-ad-renderer',
+                'ytd-banner-promo-renderer',
+                'ytd-compact-promoted-video-renderer',
+                'ytd-companion-slot-renderer',
+                'ytd-display-ad-renderer',
+                'ytd-promoted-sparkles-text-search-renderer',
+                'ytd-promoted-sparkles-web-renderer',
+                'ytd-search-pyv-renderer',
+                'ytd-single-option-survey-renderer',
+                'ytd-video-masthead-ad-advertiser-info-renderer',
+                'ytd-video-masthead-ad-v3-renderer',
+                'YTM-PROMOTED-VIDEO-RENDERER',
+            ],
+            'm.youtube.com': [
+                '.companion-ad-container',
+                '.ytp-ad-action-interstitial',
+                '.ytp-cued-thumbnail-overlay > div[style*="/sddefault.jpg"]',
+                'a[href^="/watch?v="][onclick^="return 
koya.onEvent(arguments[0]||window.event,\'"]:not([role]):not([class]):not([id])',
+                'a[onclick*=\'"ping_url":"http://www.google.com/aclk?\']',
+                'ytm-companion-ad-renderer',
+                'ytm-companion-slot',
+                'ytm-promoted-sparkles-text-search-renderer',
+                'ytm-promoted-sparkles-web-renderer',
+                'ytm-promoted-video-renderer',
+            ],
+        };
+
+        /**
+         * Adds CSS to the page
+         * @param {string} hostname hostname
+         */
+        const hideElements = (hostname) => {
+            const selectors = hiddenCSS[hostname];
+            if (!selectors) {
+                return;
+            }
+            const rule = `${selectors.join(', ')} { display: none!important; 
}`;
+            const style = document.createElement('style');
+            style.innerHTML = rule;
+            document.head.appendChild(style);
+        };
+
+        /**
+         * Calls the "callback" function on every DOM change, but not for the 
tracked events
+         * @param {Function} callback callback function
+         */
+        const observeDomChanges = (callback) => {
+            const domMutationObserver = new MutationObserver((mutations) => {
+                callback(mutations);
+            });
+
+            domMutationObserver.observe(document.documentElement, {
+                childList: true,
+                subtree: true,
+            });
+        };
+
+        /**
+         * This function is supposed to be called on every DOM change
+         */
+        const hideDynamicAds = () => {
+            const elements = document.querySelectorAll('#contents > 
ytd-rich-item-renderer ytd-display-ad-renderer');
+            if (elements.length === 0) {
+                return;
+            }
+            elements.forEach((el) => {
+                if (el.parentNode && el.parentNode.parentNode) {
+                    const parent = el.parentNode.parentNode;
+                    if (parent.localName === 'ytd-rich-item-renderer') {
+                        parent.style.display = 'none';
+                    }
+                }
+            });
+        };
+
+        /**
+         * This function checks if the video ads are currently running
+         * and auto-clicks the skip button.
+         */
+        const autoSkipAds = () => {
+            // If there's a video that plays the ad at this moment, scroll 
this ad
+            if (document.querySelector('.ad-showing')) {
+                const video = document.querySelector('video');
+                if (video && video.duration) {
+                    video.currentTime = video.duration;
+                    // Skip button should appear after that,
+                    // now simply click it automatically
+                    setTimeout(() => {
+                        const skipBtn = 
document.querySelector('button.ytp-ad-skip-button');
+                        if (skipBtn) {
+                            skipBtn.click();
+                        }
+                    }, 100);
+                }
+            }
+        };
+
+        /**
+         * This function overrides a property on the specified object.
+         *
+         * @param {object} obj object to look for properties in
+         * @param {string} propertyName property to override
+         * @param {*} overrideValue value to set
+         */
+        const overrideObject = (obj, propertyName, overrideValue) => {
+            if (!obj) {
+                return false;
+            }
+            let overriden = false;
+
+            for (const key in obj) {
+                if (obj.hasOwnProperty(key) && key === propertyName) {
+                    obj[key] = overrideValue;
+                    overriden = true;
+                } else if (obj.hasOwnProperty(key) && typeof obj[key] === 
'object') {
+                    if (overrideObject(obj[key], propertyName, overrideValue)) 
{
+                        overriden = true;
+                    }
+                }
+            }
+
+            if (overriden) {
+                console.log(`found: ${propertyName}`);
+            }
+
+            return overriden;
+        };
+
+        /**
+         * Overrides JSON.parse and Response.json functions.
+         * Examines these functions arguments, looks for properties with the 
specified name there
+         * and if it exists, changes it's value to what was specified.
+         *
+         * @param {string} propertyName name of the property
+         * @param {*} overrideValue new value for the property
+         */
+        const jsonOverride = (propertyName, overrideValue) => {
+            const nativeJSONParse = JSON.parse;
+            JSON.parse = (...args) => {
+                const obj = nativeJSONParse.apply(this, args);
+
+                // Override it's props and return back to the caller
+                overrideObject(obj, propertyName, overrideValue);
+                return obj;
+            };
+
+            // Override Response.prototype.json
+            const nativeResponseJson = Response.prototype.json;
+            Response.prototype.json = new Proxy(nativeResponseJson, {
+                apply(...args) {
+                    // Call the target function, get the original Promise
+                    const promise = Reflect.apply(args);
+
+                    // Create a new one and override the JSON inside
+                    return new Promise((resolve, reject) => {
+                        promise.then((data) => {
+                            overrideObject(data, propertyName, overrideValue);
+                            resolve(data);
+                        }).catch((error) => reject(error));
+                    });
+                },
+            });
+        };
+
+        const addAdGuardLogoStyle = () => {
+            const id = 'block-youtube-ads-logo-style';
+            if (document.getElementById(id)) {
+                return;
+            }
+
+            // Here is what these styles do:
+            // 1. Change AG marker color depending on the page
+            // 2. Hide Sign-in button on m.youtube.com otherwise it does not 
look good
+            // It is still possible to sign in by clicking "three dots" button.
+            // 3. Hide the marker when the user is searching for something
+            // 4. On YT Music apply display:block to the logo element
+            const style = document.createElement('style');
+            style.innerHTML = `[data-mode="watch"] #${LOGO_ID} { color: #fff; }
+[data-mode="searching"] #${LOGO_ID}, [data-mode="search"] #${LOGO_ID} { 
display: none; }
+#${LOGO_ID} { white-space: nowrap; }
+.mobile-topbar-header-sign-in-button { display: none; }
+.ytmusic-nav-bar#left-content #${LOGO_ID} { display: block; }`;
+            document.head.appendChild(style);
+        };
+
+        const addAdGuardLogo = () => {
+            if (document.getElementById(LOGO_ID)) {
+                return;
+            }
+
+            const logo = document.createElement('span');
+            // logo.innerHTML = '__logo_text__';
+            logo.setAttribute('id', LOGO_ID);
+
+            if (window.location.hostname === 'm.youtube.com') {
+                const btn = 
document.querySelector('header.mobile-topbar-header > button');
+                if (btn) {
+                    btn.parentNode.insertBefore(logo, btn.nextSibling);
+                    addAdGuardLogoStyle();
+                }
+            } else if (window.location.hostname === 'www.youtube.com') {
+                const code = document.getElementById('country-code');
+                if (code) {
+                    code.innerHTML = '';
+                    code.appendChild(logo);
+                    addAdGuardLogoStyle();
+                }
+            } else if (window.location.hostname === 'music.youtube.com') {
+                const el = 
document.querySelector('.ytmusic-nav-bar#left-content');
+                if (el) {
+                    el.appendChild(logo);
+                    addAdGuardLogoStyle();
+                }
+            }
+        };
+
+        // Removes ads metadata from YouTube XHR requests
+        jsonOverride('adPlacements', []);
+        jsonOverride('playerAds', []);
+
+        // Applies CSS that hides YouTube ad elements
+        hideElements(window.location.hostname);
+
+        // Some changes should be re-evaluated on every page change
+        addAdGuardLogo();
+        hideDynamicAds();
+        autoSkipAds();
+        observeDomChanges(() => {
+            addAdGuardLogo();
+            hideDynamicAds();
+            autoSkipAds();
+        });
+    };
+
+    const script = document.createElement('script');
+    const scriptText = pageScript.toString().replace('__logo_text__', 
getMessage('logo'));
+    script.innerHTML = `(${scriptText})();`;
+    document.head.appendChild(script);
+    document.head.removeChild(script);
+
+    return {
+        success: true,
+        status: 'success',
+        message: getMessage('success'),
+    };
+}
+
+/**
+ * Runs the shortcut
+ */
+(() => {
+    // "completion" function is only defined if this script is launched as 
Shortcut
+    // in other cases we simply polyfill it.
+    let finish = (m) => { console.log(m); };
+    if (typeof completion !== 'undefined') {
+        finish = completion;
+    }
+
+    try {
+        const result = runBlockYoutube();
+        finish(result.message);
+    } catch (ex) {
+        finish(ex.toString());
+    }
+})();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/epiphany-40.2/third-party/meson.build 
new/epiphany-40.3/third-party/meson.build
--- old/epiphany-40.2/third-party/meson.build   2021-06-04 16:41:43.641404000 
+0200
+++ new/epiphany-40.3/third-party/meson.build   2021-08-12 21:31:10.288086400 
+0200
@@ -1,3 +1,10 @@
+adguard_resource_files = files('adguard/adguard.gresource.xml')
+adguard_resources = gnome.compile_resources('adguard-resources',
+    adguard_resource_files,
+    c_name: 'adguard',
+    source_dir: 'adguard'
+)
+
 pdfjs_resource_files = files('pdfjs/pdfjs.gresource.xml')
 pdfjs_resources = gnome.compile_resources('pdfjs-resources',
     pdfjs_resource_files,

Reply via email to