...
 
Commits (86)
3.27.90 - February 12, 2017
3.28.5 - September 21, 2018
===========================
This release is intended to fix video playback on YouTube. We believe that
YouTube began requiring media source extensions to play WebM videos on Tuesday
of this week, so we have enabled it.
You are strongly encouraged to update to WebKitGTK+ 2.22.2 and the forthcoming
GStreamer 1.14.4 to minimize video playback disruptions. It's not really
reliable enough to be enabled yet, but it's a whole lot better than no YouTube.
3.28.4 - September 2, 2018
==========================
- Improve performance of adblocker (#37)
- Ensure correct address is displayed in security popover when starting loads (#503)
- Fix crash on homedepot.com
- Improve use of Safe Browsing threat lists
- Fix miscellaneous memory leaks
3.28.3.1 - June 8, 2018
=======================
- Fix missing symbol in 3.28.3 (#33)
3.28.3 - June 7, 2018
=====================
- Fix CVE-2018-11396/CVE-2018-12016 (#795740)
- Allow Ctrl+T in app mode again due to unintended consequences (#796204)
- Don't remember passwords when the setting is disabled (#796219)
- Fix password manager crash on chase.com (GitLab #11)
3.28.2.1 - May 22, 2018
=======================
- New release because I pushed the 3.28.2 tag too soon.
3.28.2 - May 21, 2018
=====================
- Again disallow Ctrl+T in app mode (#795007)
- Remove problematic adblock filters (#796245)
- Fix crashes when signing out of Firefox Sync (Gabriel Ivascu)
3.28.1.1 - April 19, 2018
=========================
- Fix two crashes (#783756 and #794784/#795370)
3.28.1 - April 10, 2018
=======================
- Fix bookmarks migration from Epiphany 3.24 not working (#794645)
- Do not auto-open adblock filters in text editor after download (#794646)
- Fix crash when destroying sync service (#794728)
- Remove the experimental HTTPS Everywhere support (#794803)
- Fix width of bookmarks popover in certain locales (#794861, Exalm)
- Don't activate search bar when pressing ' or / (#795083)
- Take snapshots only of most-visited web pages
3.28.0.1 - March 10, 2018
=========================
- No changes, new release because 3.28.0 was mistagged
3.28.0 - March 10, 2018
=======================
- Fix buffer overflow in profile migrator test
- Updated translations
3.27.92 - March 2, 2018
=======================
- Add middle click close support to tab bar
3.27.90 - February 12, 2018
===========================
- Improve handling of zoom (#621067, #792949, Jan-Michael Brummer)
......@@ -15,7 +92,7 @@
- Hopefully fix the search provider (Bjørn Lie)
- Fix password prompt after #742573 (Exalm)
3.27.4 - January 6, 2017
3.27.4 - January 6, 2018
========================
- Show desktop notification when download finishes (#722142)
......
......@@ -19,14 +19,23 @@ i18n.merge_file('appdata-file',
po_dir: '../po'
)
# We need three custom_target() calls because Meson doesn't have very
# good support for GSettings yet. First, generate our GSettings enums
# in the build directory. Then, copy the gschema into the build
# directory to ensure it is in the same place as the enums file. Then
# we can run glib-compile-schemas on it. We have to compile schemas in
# the build directory to ensure that our tests don't fail if run on a
# system where epiphany is not already installed. epiphany will also
# look for schemas here if built in developer mode.
#
# https://github.com/mesonbuild/meson/issues/1687
custom_target('gsettings-enums',
generate_enums = custom_target('gsettings-enums',
input: '../lib/ephy-prefs.h',
output: 'org.gnome.Epiphany.enums.xml',
install: true,
install_dir: join_paths(datadir, 'glib-2.0', 'schemas'),
capture: true,
command: ['glib-mkenums',
command: [find_program('glib-mkenums'),
'--comments', '<!-- @comment@ -->',
'--fhead', '<schemalist>',
'--vhead', ' <@type@ id="org.gnome.Epiphany.@EnumName@">',
......@@ -36,6 +45,19 @@ custom_target('gsettings-enums',
'@INPUT@'
]
)
copy_gschema = custom_target('copy-gschema-to-builddir',
input: 'org.gnome.epiphany.gschema.xml',
output: 'renamed-hack.gschema.xml',
command: ['cp', '@INPUT@', '@OUTPUT@']
)
compile_schemas = custom_target('glib-compile-schemas',
output: 'gschemas.compiled',
install: false,
command: [find_program('glib-compile-schemas'),
meson.current_build_dir()
],
depends: [generate_enums, copy_gschema]
)
install_data('org.gnome.epiphany.gschema.xml',
install_dir: join_paths(datadir, 'glib-2.0', 'schemas')
)
......
......@@ -101,7 +101,7 @@
</key>
<key type="as" name="adblock-filters">
<default>['https://easylist.to/easylist/easylist.txt', 'https://easylist.to/easylist/easyprivacy.txt', 'https://easylist.to/easylist/fanboy-annoyance.txt']</default>
<default>['https://easylist.to/easylist/easylist.txt', 'https://easylist.to/easylist/easyprivacy.txt']</default>
<summary>List of adblock filters</summary>
<description>List of URLs with filter rules to be used by the adblock.</description>
</key>
......
......@@ -451,6 +451,10 @@ ephy_download_do_download_action (EphyDownload *download,
LOG ("ephy_download_do_download_action: none");
ret = TRUE;
break;
case EPHY_DOWNLOAD_ACTION_DO_NOT_AUTO_OPEN:
LOG ("ephy_download_do_download_action: do_not_auto_open");
ret = TRUE;
break;
default:
g_assert_not_reached ();
}
......
......@@ -33,7 +33,8 @@ typedef enum
{
EPHY_DOWNLOAD_ACTION_NONE,
EPHY_DOWNLOAD_ACTION_BROWSE_TO,
EPHY_DOWNLOAD_ACTION_OPEN
EPHY_DOWNLOAD_ACTION_OPEN,
EPHY_DOWNLOAD_ACTION_DO_NOT_AUTO_OPEN
} EphyDownloadActionType;
EphyDownload *ephy_download_new (WebKitDownload *download);
......
......@@ -431,6 +431,7 @@ ephy_embed_prefs_init (gpointer user_data)
"enable-fullscreen", TRUE,
"enable-javascript", TRUE,
"enable-dns-prefetching", TRUE,
"enable-mediasource", TRUE,
"javascript-can-open-windows-automatically", TRUE,
NULL);
......
......@@ -47,10 +47,6 @@
#include <gtk/gtk.h>
#include <stdlib.h>
#if ENABLE_HTTPS_EVERYWHERE
#include <httpseverywhere.h>
#endif
#define PAGE_SETUP_FILENAME "page-setup-gtk.ini"
#define PRINT_SETTINGS_FILENAME "print-settings.ini"
#define OVERVIEW_RELOAD_DELAY 500
......@@ -571,21 +567,21 @@ ephy_embed_shell_get_global_history_service (EphyEmbedShell *shell)
priv->global_history_service = ephy_history_service_new (filename, mode);
g_free (filename);
g_assert (priv->global_history_service);
g_signal_connect (priv->global_history_service, "urls-visited",
G_CALLBACK (history_service_urls_visited_cb),
shell);
g_signal_connect (priv->global_history_service, "url-title-changed",
G_CALLBACK (history_service_url_title_changed_cb),
shell);
g_signal_connect (priv->global_history_service, "url-deleted",
G_CALLBACK (history_service_url_deleted_cb),
shell);
g_signal_connect (priv->global_history_service, "host-deleted",
G_CALLBACK (history_service_host_deleted_cb),
shell);
g_signal_connect (priv->global_history_service, "cleared",
G_CALLBACK (history_service_cleared_cb),
shell);
g_signal_connect_object (priv->global_history_service, "urls-visited",
G_CALLBACK (history_service_urls_visited_cb),
shell, 0);
g_signal_connect_object (priv->global_history_service, "url-title-changed",
G_CALLBACK (history_service_url_title_changed_cb),
shell, 0);
g_signal_connect_object (priv->global_history_service, "url-deleted",
G_CALLBACK (history_service_url_deleted_cb),
shell, 0);
g_signal_connect_object (priv->global_history_service, "host-deleted",
G_CALLBACK (history_service_host_deleted_cb),
shell, 0);
g_signal_connect_object (priv->global_history_service, "cleared",
G_CALLBACK (history_service_cleared_cb),
shell, 0);
}
return priv->global_history_service;
......@@ -825,8 +821,8 @@ ephy_embed_shell_setup_web_extensions_server (EphyEmbedShell *shell)
guid = g_dbus_generate_guid ();
observer = g_dbus_auth_observer_new ();
g_signal_connect (observer, "authorize-authenticated-peer",
G_CALLBACK (authorize_authenticated_peer_cb), shell);
g_signal_connect_object (observer, "authorize-authenticated-peer",
G_CALLBACK (authorize_authenticated_peer_cb), shell, 0);
/* Why sync?
*
......@@ -846,8 +842,8 @@ ephy_embed_shell_setup_web_extensions_server (EphyEmbedShell *shell)
goto out;
}
g_signal_connect (priv->dbus_server, "new-connection",
G_CALLBACK (new_connection_cb), shell);
g_signal_connect_object (priv->dbus_server, "new-connection",
G_CALLBACK (new_connection_cb), shell, 0);
g_dbus_server_start (priv->dbus_server);
out:
......@@ -913,26 +909,6 @@ ephy_embed_shell_create_web_context (EphyEmbedShell *shell)
g_object_unref (manager);
}
#if ENABLE_HTTPS_EVERYWHERE
static void
https_everywhere_update_cb (HTTPSEverywhereUpdater *updater,
GAsyncResult *result)
{
GError *error = NULL;
https_everywhere_updater_update_finish (updater, result, &error);
if (!error)
return;
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
!g_error_matches (error, HTTPS_EVERYWHERE_UPDATE_ERROR, HTTPS_EVERYWHERE_UPDATE_ERROR_IN_PROGRESS) &&
!g_error_matches (error, HTTPS_EVERYWHERE_UPDATE_ERROR, HTTPS_EVERYWHERE_UPDATE_ERROR_NO_UPDATE_AVAILABLE))
g_warning ("Failed to update HTTPS Everywhere rulesets: %s", error->message);
g_error_free (error);
}
#endif
static char *
adblock_filters_dir (EphyEmbedShell *shell)
{
......@@ -960,10 +936,6 @@ ephy_embed_shell_startup (GApplication *application)
char *filename;
char *cookie_policy;
char *filters_dir;
#if ENABLE_HTTPS_EVERYWHERE
HTTPSEverywhereContext *context;
HTTPSEverywhereUpdater *updater;
#endif
G_APPLICATION_CLASS (ephy_embed_shell_parent_class)->startup (application);
......@@ -977,49 +949,49 @@ ephy_embed_shell_startup (GApplication *application)
webkit_user_content_manager_register_script_message_handler (priv->user_content,
"overview");
g_signal_connect (priv->user_content, "script-message-received::overview",
G_CALLBACK (web_extension_overview_message_received_cb),
shell);
g_signal_connect_object (priv->user_content, "script-message-received::overview",
G_CALLBACK (web_extension_overview_message_received_cb),
shell, 0);
webkit_user_content_manager_register_script_message_handler (priv->user_content,
"tlsErrorPage");
g_signal_connect (priv->user_content, "script-message-received::tlsErrorPage",
G_CALLBACK (web_extension_tls_error_page_message_received_cb),
shell);
g_signal_connect_object (priv->user_content, "script-message-received::tlsErrorPage",
G_CALLBACK (web_extension_tls_error_page_message_received_cb),
shell, 0);
webkit_user_content_manager_register_script_message_handler (priv->user_content,
"unsafeBrowsingErrorPage");
g_signal_connect (priv->user_content, "script-message-received::unsafeBrowsingErrorPage",
G_CALLBACK (web_extension_unsafe_browsing_error_page_message_received_cb),
shell);
g_signal_connect_object (priv->user_content, "script-message-received::unsafeBrowsingErrorPage",
G_CALLBACK (web_extension_unsafe_browsing_error_page_message_received_cb),
shell, 0);
webkit_user_content_manager_register_script_message_handler (priv->user_content,
"formAuthData");
g_signal_connect (priv->user_content, "script-message-received::formAuthData",
G_CALLBACK (web_extension_form_auth_data_message_received_cb),
shell);
g_signal_connect_object (priv->user_content, "script-message-received::formAuthData",
G_CALLBACK (web_extension_form_auth_data_message_received_cb),
shell, 0);
webkit_user_content_manager_register_script_message_handler (priv->user_content,
"sensitiveFormFocused");
g_signal_connect (priv->user_content, "script-message-received::sensitiveFormFocused",
G_CALLBACK (web_extension_sensitive_form_focused_message_received_cb),
shell);
g_signal_connect_object (priv->user_content, "script-message-received::sensitiveFormFocused",
G_CALLBACK (web_extension_sensitive_form_focused_message_received_cb),
shell, 0);
webkit_user_content_manager_register_script_message_handler (priv->user_content,
"aboutApps");
g_signal_connect (priv->user_content, "script-message-received::aboutApps",
G_CALLBACK (web_extension_about_apps_message_received_cb),
shell);
g_signal_connect_object (priv->user_content, "script-message-received::aboutApps",
G_CALLBACK (web_extension_about_apps_message_received_cb),
shell, 0);
ephy_embed_shell_setup_process_model (shell);
g_signal_connect (priv->web_context, "initialize-web-extensions",
G_CALLBACK (initialize_web_extensions),
shell);
g_signal_connect_object (priv->web_context, "initialize-web-extensions",
G_CALLBACK (initialize_web_extensions),
shell, 0);
priv->permissions_manager = ephy_permissions_manager_new ();
g_signal_connect (priv->web_context, "initialize-notification-permissions",
G_CALLBACK (initialize_notification_permissions),
shell);
g_signal_connect_object (priv->web_context, "initialize-notification-permissions",
G_CALLBACK (initialize_notification_permissions),
shell, 0);
/* Favicon Database */
if (priv->mode == EPHY_EMBED_SHELL_MODE_PRIVATE)
......@@ -1071,24 +1043,6 @@ ephy_embed_shell_startup (GApplication *application)
filters_dir = adblock_filters_dir (shell);
priv->filters_manager = ephy_filters_manager_new (filters_dir);
g_free (filters_dir);
#if ENABLE_HTTPS_EVERYWHERE
/* We might want to be smarter about this in the future. For now,
* trigger an update of the rulesets once each time Epiphany is started.
* Note that the updated rules will not be used until the next time Epiphany
* is started. */
if (priv->mode != EPHY_EMBED_SHELL_MODE_TEST &&
priv->mode != EPHY_EMBED_SHELL_MODE_SEARCH_PROVIDER) {
context = https_everywhere_context_new ();
updater = https_everywhere_updater_new (context);
https_everywhere_updater_update (updater,
priv->cancellable,
(GAsyncReadyCallback)https_everywhere_update_cb,
NULL);
g_object_unref (context);
g_object_unref (updater);
}
#endif
}
static void
......@@ -1103,7 +1057,9 @@ ephy_embed_shell_shutdown (GApplication *application)
webkit_user_content_manager_unregister_script_message_handler (priv->user_content, "overview");
webkit_user_content_manager_unregister_script_message_handler (priv->user_content, "tlsErrorPage");
webkit_user_content_manager_unregister_script_message_handler (priv->user_content, "unsafeBrowsingErrorPage");
webkit_user_content_manager_unregister_script_message_handler (priv->user_content, "formAuthData");
webkit_user_content_manager_unregister_script_message_handler (priv->user_content, "sensitiveFormFocused");
webkit_user_content_manager_unregister_script_message_handler (priv->user_content, "aboutApps");
g_list_foreach (priv->web_extensions, (GFunc)ephy_embed_shell_unwatch_web_extension, application);
......
......@@ -33,6 +33,9 @@
#include <libsoup/soup.h>
#include <string.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static GRegex *non_search_regex;
static GRegex *domain_regex;
......@@ -408,3 +411,5 @@ ephy_embed_utils_shutdown (void)
g_clear_pointer (&non_search_regex, (GDestroyNotify)g_regex_unref);
g_clear_pointer (&domain_regex, (GDestroyNotify)g_regex_unref);
}
#pragma GCC diagnostic pop
......@@ -88,7 +88,7 @@ typedef struct {
static AdblockFilterRetrieveData *
adblock_filter_retrieve_data_new (EphyFiltersManager *manager,
EphyDownload *download,
char *source_uri)
const char *source_uri)
{
AdblockFilterRetrieveData* data;
data = g_slice_new (AdblockFilterRetrieveData);
......@@ -148,6 +148,7 @@ start_retrieving_filter_file (EphyFiltersManager *manager,
char *path;
download = ephy_download_new_for_uri (filter_url);
ephy_download_set_action (download, EPHY_DOWNLOAD_ACTION_DO_NOT_AUTO_OPEN);
path = g_file_get_uri (destination);
ephy_download_set_destination_uri (download, path);
ephy_download_disable_desktop_notification (download);
......@@ -156,7 +157,7 @@ start_retrieving_filter_file (EphyFiltersManager *manager,
wk_download = ephy_download_get_webkit_download (download);
webkit_download_set_allow_overwrite (wk_download, TRUE);
data = adblock_filter_retrieve_data_new (manager, download, g_strdup (filter_url));
data = adblock_filter_retrieve_data_new (manager, download, filter_url);
g_signal_connect (download, "completed",
G_CALLBACK (download_completed_cb), data);
......
......@@ -134,32 +134,6 @@ clear_status (EphyFindToolbar *toolbar)
webkit_find_controller_search_finish (toolbar->controller);
}
/* Code adapted from gtktreeview.c:gtk_tree_view_key_press() and
* gtk_tree_view_real_start_interactive_seach()
*/
static gboolean
tab_search_key_press_cb (WebKitWebView *web_view,
GdkEventKey *event,
EphyFindToolbar *toolbar)
{
GtkWidget *widget = (GtkWidget *)toolbar;
g_assert (event != NULL);
/* check for / and ' which open the find toolbar in text resp. link mode */
if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (widget)) == FALSE) {
if (event->keyval == GDK_KEY_slash) {
ephy_find_toolbar_open (toolbar, FALSE, TRUE);
return TRUE;
} else if (event->keyval == GDK_KEY_apostrophe) {
ephy_find_toolbar_open (toolbar, TRUE, TRUE);
return TRUE;
}
}
return FALSE;
}
static void
real_find (EphyFindToolbar *toolbar,
EphyFindDirection direction)
......@@ -562,10 +536,6 @@ ephy_find_toolbar_set_web_view (EphyFindToolbar *toolbar,
toolbar);
clear_status (toolbar);
g_signal_connect_object (EPHY_WEB_VIEW (web_view), "search-key-press",
G_CALLBACK (tab_search_key_press_cb),
toolbar, 0);
}
}
......
......@@ -111,6 +111,7 @@ struct _EphyWebView {
GCancellable *history_service_cancellable;
guint snapshot_timeout_id;
char *pending_snapshot_uri;
EphyHistoryPageVisitType visit_type;
......@@ -628,21 +629,71 @@ got_snapshot_path_cb (EphySnapshotService *service,
g_free (url);
}
static gboolean
web_view_check_snapshot (WebKitWebView *web_view)
static void
take_snapshot (EphyWebView *view)
{
EphyWebView *view = EPHY_WEB_VIEW (web_view);
EphySnapshotService *service = ephy_snapshot_service_get_default ();
const char *url = webkit_web_view_get_uri (web_view);
ephy_snapshot_service_get_snapshot_path_async (service, WEBKIT_WEB_VIEW (view), NULL,
(GAsyncReadyCallback)got_snapshot_path_cb,
g_strdup (view->pending_snapshot_uri));
}
static void
history_service_query_urls_cb (EphyHistoryService *service,
gboolean success,
GList *urls,
EphyWebView *view)
{
const char *url = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view));
if (!success)
goto out;
/* Have we already started a new load? */
if (g_strcmp0 (url, view->pending_snapshot_uri) != 0)
goto out;
for (GList *l = urls; l; l = g_list_next (l)) {
EphyHistoryURL *history_url = l->data;
/* Take snapshot if this URL is one of the top history results. */
if (strcmp (history_url->url, view->pending_snapshot_uri) == 0) {
take_snapshot (view);
break;
}
}
out:
g_clear_pointer (&view->pending_snapshot_uri, g_free);
g_object_unref (view);
}
static gboolean
maybe_take_snapshot (EphyWebView *view)
{
EphyEmbedShell *shell;
EphyHistoryService *service;
EphyHistoryQuery *query;
view->snapshot_timeout_id = 0;
if (view->error_page != EPHY_WEB_VIEW_ERROR_PAGE_NONE)
return FALSE;
ephy_snapshot_service_get_snapshot_path_async (service, web_view, NULL,
(GAsyncReadyCallback)got_snapshot_path_cb,
g_strdup (url));
shell = ephy_embed_shell_get_default ();
service = ephy_embed_shell_get_global_history_service (shell);
/* We want to save snapshots for just a couple more pages than are present
* in the overview, so new snapshots are immediately available when the user
* deletes a couple pages from the overview. Let's say five more.
*/
query = ephy_history_query_new_for_overview ();
query->limit += 5;
ephy_history_service_query_urls (service, query, NULL,
(EphyHistoryJobCallback)history_service_query_urls_cb,
g_object_ref (view));
ephy_history_query_free (query);
return FALSE;
}
......@@ -921,6 +972,7 @@ ephy_web_view_finalize (GObject *object)
g_free (view->link_message);
g_free (view->loading_message);
g_free (view->tls_error_failing_uri);
g_free (view->pending_snapshot_uri);
G_OBJECT_CLASS (ephy_web_view_parent_class)->finalize (object);
}
......@@ -977,7 +1029,7 @@ ephy_web_view_set_address (EphyWebView *view,
view->address = g_strdup (address);
g_free (view->display_address);
view->display_address = ephy_uri_decode (view->address);
view->display_address = view->address != NULL ? ephy_uri_decode (view->address) : NULL;
_ephy_web_view_set_is_blank (view, ephy_embed_utils_url_is_empty (address));
......@@ -1821,8 +1873,10 @@ load_changed_cb (WebKitWebView *web_view,
*/
if (view->snapshot_timeout_id == 0) {
view->snapshot_timeout_id = g_timeout_add_seconds_full (G_PRIORITY_LOW, 1,
(GSourceFunc)web_view_check_snapshot,
(GSourceFunc)maybe_take_snapshot,
web_view, NULL);
g_free (view->pending_snapshot_uri);
view->pending_snapshot_uri = g_strdup (webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view)));
}
}
......@@ -3265,6 +3319,7 @@ ephy_web_view_get_web_app_title_finish (EphyWebView *view,
* ephy_web_view_get_security_level:
* @view: an #EphyWebView
* @level: (out): return value of security level
* @address: (out) (transfer none): the URI to which the security level corresponds
* @certificate: (out) (transfer none): return value of TLS certificate
* @errors: (out): return value of TLS errors
*
......@@ -3273,16 +3328,20 @@ ephy_web_view_get_web_app_title_finish (EphyWebView *view,
* have been found with that certificate.
**/
void
ephy_web_view_get_security_level (EphyWebView *view,
EphySecurityLevel *level,
GTlsCertificate **certificate,
GTlsCertificateFlags *errors)
ephy_web_view_get_security_level (EphyWebView *view,
EphySecurityLevel *level,
const char **address,
GTlsCertificate **certificate,
GTlsCertificateFlags *errors)
{
g_assert (EPHY_IS_WEB_VIEW (view));
if (level)
*level = view->security_level;
if (address)
*address = view->last_committed_address;
if (certificate)
*certificate = view->certificate;
......
......@@ -105,6 +105,7 @@ gboolean ephy_web_view_has_modified_forms_finish (EphyWebView
GError **error);
void ephy_web_view_get_security_level (EphyWebView *view,
EphySecurityLevel *level,
const char **address,
GTlsCertificate **certificate,
GTlsCertificateFlags *errors);
void ephy_web_view_print (EphyWebView *view);
......
......@@ -43,10 +43,6 @@ libephyembed_deps = [
webkit2gtk_dep
]
if get_option('https_everywhere')
libephyembed_deps += httpseverywhere_dep
endif
libephyembed_includes = include_directories(
'.',
'..',
......
......@@ -21,11 +21,16 @@
#include <config.h>
#include "ephy-embed-form-auth.h"
#include "ephy-uri-helpers.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
struct _EphyEmbedFormAuth {
GObject parent_instance;
guint64 page_id;
SoupURI *uri;
char *origin;
char *target_origin;
WebKitDOMNode *username_node;
WebKitDOMNode *password_node;
......@@ -41,10 +46,9 @@ ephy_embed_form_auth_finalize (GObject *object)
{
EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (object);
if (form_auth->uri)
soup_uri_free (form_auth->uri);
g_free (form_auth->username);
g_free (form_auth->password);
g_free (form_auth->origin);
g_free (form_auth->target_origin);
g_clear_object (&form_auth->username_node);
g_clear_object (&form_auth->password_node);
......@@ -67,29 +71,45 @@ ephy_embed_form_auth_class_init (EphyEmbedFormAuthClass *klass)
EphyEmbedFormAuth *
ephy_embed_form_auth_new (WebKitWebPage *web_page,
const char *target_origin,
const char *form_action,
WebKitDOMNode *username_node,
WebKitDOMNode *password_node,
const char *username,
const char *password)
{
EphyEmbedFormAuth *form_auth;
char *origin;
g_assert (WEBKIT_DOM_IS_NODE (password_node));
origin = ephy_uri_to_security_origin (webkit_web_page_get_uri (web_page));
if (!origin)
return NULL;
form_auth = EPHY_EMBED_FORM_AUTH (g_object_new (EPHY_TYPE_EMBED_FORM_AUTH, NULL));
form_auth->page_id = webkit_web_page_get_id (web_page);
form_auth->uri = soup_uri_new (webkit_web_page_get_uri (web_page));
form_auth->target_origin = g_strdup (target_origin);
form_auth->origin = origin;
form_auth->username_node = username_node;
form_auth->password_node = password_node;
form_auth->username = g_strdup (username);
form_auth->password = g_strdup (password);
if (form_action)
form_auth->target_origin = ephy_uri_to_security_origin (form_action);
if (!form_auth->target_origin)
form_auth->target_origin = g_strdup (form_auth->origin);
return form_auth;
}
const char *
ephy_embed_form_auth_get_origin (EphyEmbedFormAuth *form_auth)
{
return form_auth->origin;
}
const char *
ephy_embed_form_auth_get_target_origin (EphyEmbedFormAuth *form_auth)
{
......@@ -108,12 +128,6 @@ ephy_embed_form_auth_get_password_node (EphyEmbedFormAuth *form_auth)
return form_auth->password_node;
}
SoupURI *
ephy_embed_form_auth_get_uri (EphyEmbedFormAuth *form_auth)
{
return form_auth->uri;
}
guint64
ephy_embed_form_auth_get_page_id (EphyEmbedFormAuth *form_auth)
{
......@@ -150,3 +164,5 @@ ephy_embed_form_auth_get_owner_document (EphyEmbedFormAuth *form_auth)
{
return webkit_dom_node_get_owner_document (form_auth->password_node);
}
#pragma GCC diagnostic pop
......@@ -31,15 +31,15 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (EphyEmbedFormAuth, ephy_embed_form_auth, EPHY, EMBED_FORM_AUTH, GObject)
EphyEmbedFormAuth *ephy_embed_form_auth_new (WebKitWebPage *web_page,
const char *target_origin,
const char *form_action,
WebKitDOMNode *username_node,
WebKitDOMNode *password_node,
const char *username,
const char *password);
WebKitDOMNode *ephy_embed_form_auth_get_username_node (EphyEmbedFormAuth *form_auth);
WebKitDOMNode *ephy_embed_form_auth_get_password_node (EphyEmbedFormAuth *form_auth);
const char *ephy_embed_form_auth_get_origin (EphyEmbedFormAuth *form_auth);
const char *ephy_embed_form_auth_get_target_origin (EphyEmbedFormAuth *form_auth);
SoupURI *ephy_embed_form_auth_get_uri (EphyEmbedFormAuth *form_auth);
guint64 ephy_embed_form_auth_get_page_id (EphyEmbedFormAuth *form_auth);
const char *ephy_embed_form_auth_get_username (EphyEmbedFormAuth *form_auth);
const char *ephy_embed_form_auth_get_password (EphyEmbedFormAuth *form_auth);
......
......@@ -37,10 +37,6 @@
#include <libsoup/soup.h>
#include <string.h>
#if ENABLE_HTTPS_EVERYWHERE
#include <httpseverywhere.h>
#endif
#define SIGNATURE_SIZE 8
struct _EphyUriTester {
......@@ -69,11 +65,6 @@ struct _EphyUriTester {
GMainLoop *load_loop;
int adblock_filters_to_load;
gboolean adblock_loaded;
#if ENABLE_HTTPS_EVERYWHERE
gboolean https_everywhere_loaded;
HTTPSEverywhereContext *https_everywhere_context;
#endif
};
enum {
......@@ -187,18 +178,18 @@ ephy_uri_tester_is_matched (EphyUriTester *tester,
const char *page_uri,
gboolean whitelist)
{
char *value;
gpointer is_matched;
GHashTable *urlcache = tester->urlcache;
if (whitelist)
urlcache = tester->whitelisted_urlcache;
/* Check cached URLs first. */
if ((value = g_hash_table_lookup (urlcache, req_uri)))
return GPOINTER_TO_INT (value);
if (g_hash_table_lookup_extended (urlcache, req_uri, NULL, &is_matched))
return GPOINTER_TO_INT (is_matched);
/* Look for a match either by key or by pattern. */
if (ephy_uri_tester_is_matched_by_key (tester, opts, req_uri, page_uri, whitelist)) {
g_hash_table_insert (urlcache, g_strdup (req_uri), g_strdup ("1"));
g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (TRUE));
return TRUE;
}
......@@ -208,6 +199,7 @@ ephy_uri_tester_is_matched (EphyUriTester *tester,
return TRUE;
}
/* No match. */
g_hash_table_insert (urlcache, g_strdup (req_uri), GINT_TO_POINTER (FALSE));
return FALSE;
}
......@@ -538,25 +530,10 @@ ephy_uri_tester_adblock_loaded (EphyUriTester *tester)
{
if (g_atomic_int_dec_and_test (&tester->adblock_filters_to_load)) {
tester->adblock_loaded = TRUE;
#if ENABLE_HTTPS_EVERYWHERE
if (tester->https_everywhere_loaded)
g_main_loop_quit (tester->load_loop);
#else
g_main_loop_quit (tester->load_loop);
#endif
}
}
#if ENABLE_HTTPS_EVERYWHERE
static void
ephy_uri_tester_https_everywhere_loaded (EphyUriTester *tester)
{
tester->https_everywhere_loaded = TRUE;
if (tester->adblock_loaded)
g_main_loop_quit (tester->load_loop);
}
#endif
static void
file_parse_cb (GDataInputStream *stream, GAsyncResult *result, EphyUriTester *tester)
{
......@@ -623,44 +600,18 @@ ephy_uri_tester_block_uri (EphyUriTester *tester,
char *
ephy_uri_tester_rewrite_uri (EphyUriTester *tester,
const char *request_uri,
const char *page_uri,
EphyUriTestFlags flags)
const char *page_uri)
{
/* Should we block the URL outright? */
if ((flags & EPHY_URI_TEST_ADBLOCK) &&
ephy_uri_tester_block_uri (tester, request_uri, page_uri)) {
if (ephy_uri_tester_block_uri (tester, request_uri, page_uri)) {
g_debug ("Request '%s' blocked (page: '%s')", request_uri, page_uri);
return NULL;
}
#if ENABLE_HTTPS_EVERYWHERE
if ((flags & EPHY_URI_TEST_HTTPS_EVERYWHERE) && tester->https_everywhere_context != NULL)
return https_everywhere_context_rewrite (tester->https_everywhere_context, request_uri);
#endif
return g_strdup (request_uri);
}
#if ENABLE_HTTPS_EVERYWHERE
static void
https_everywhere_context_init_cb (HTTPSEverywhereContext *context,
GAsyncResult *res,
EphyUriTester *tester)
{
GError *error = NULL;
https_everywhere_context_init_finish (context, res, &error);
if (error) {
g_warning ("Failed to initialize HTTPS Everywhere context: %s", error->message);
g_error_free (error);
}
ephy_uri_tester_https_everywhere_loaded (tester);
}
#endif
static void
adblock_file_monitor_changed (GFileMonitor *monitor,
GFile *file,
......@@ -723,16 +674,6 @@ ephy_uri_tester_load_sync (GTask *task,
g_main_context_push_thread_default (context);
tester->load_loop = g_main_loop_new (context, FALSE);
#if ENABLE_HTTPS_EVERYWHERE
if (!tester->https_everywhere_loaded) {
g_assert (tester->https_everywhere_context == NULL);
tester->https_everywhere_context = https_everywhere_context_new ();
https_everywhere_context_init (tester->https_everywhere_context, NULL,
(GAsyncReadyCallback)https_everywhere_context_init_cb,
tester);
}
#endif
if (!tester->adblock_loaded)
ephy_uri_tester_begin_loading_adblock_filters (tester, &monitors);
......@@ -816,22 +757,6 @@ ephy_uri_tester_set_property (GObject *object,
}
}
static void
ephy_uri_tester_dispose (GObject *object)
{
#if ENABLE_HTTPS_EVERYWHERE
EphyUriTester *tester = EPHY_URI_TESTER (object);
#endif
LOG ("EphyUriTester disposing %p", object);
#if ENABLE_HTTPS_EVERYWHERE
g_clear_object (&tester->https_everywhere_context);
#endif
G_OBJECT_CLASS (ephy_uri_tester_parent_class)->dispose (object);
}
static void
ephy_uri_tester_finalize (GObject *object)
{
......@@ -868,7 +793,6 @@ ephy_uri_tester_class_init (EphyUriTesterClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = ephy_uri_tester_set_property;
object_class->dispose = ephy_uri_tester_dispose;
object_class->finalize = ephy_uri_tester_finalize;
obj_properties[PROP_ADBLOCK_DATA_DIR] =
......@@ -931,11 +855,7 @@ ephy_uri_tester_load (EphyUriTester *tester)
if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_ADBLOCK))
tester->adblock_loaded = TRUE;
if (tester->adblock_loaded
#if ENABLE_HTTPS_EVERYWHERE
&& tester->https_everywhere_loaded
#endif
)
if (tester->adblock_loaded)
return;
g_signal_handlers_disconnect_by_func (EPHY_SETTINGS_WEB, ephy_uri_tester_adblock_filters_changed_cb, tester);
......
......@@ -28,20 +28,11 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (EphyUriTester, ephy_uri_tester, EPHY, URI_TESTER, GObject)
typedef enum
{
EPHY_URI_TEST_ADBLOCK = 1 << 1,
EPHY_URI_TEST_HTTPS_EVERYWHERE = 1 << 2,
EPHY_URI_TEST_ALL = EPHY_URI_TEST_ADBLOCK | EPHY_URI_TEST_HTTPS_EVERYWHERE
} EphyUriTestFlags;
EphyUriTester *ephy_uri_tester_new (const char *adblock_data_dir);
void ephy_uri_tester_load (EphyUriTester *tester);
char *ephy_uri_tester_rewrite_uri (EphyUriTester *tester,
const char *request_uri,
const char *page_uri,
EphyUriTestFlags flags);
const char *page_uri);
G_END_DECLS
......@@ -25,6 +25,9 @@
#include <stdio.h>
#include <string.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
typedef struct {
WebKitDOMHTMLInputElement *element;
gint index;
......@@ -802,3 +805,5 @@ ephy_web_dom_utils_get_selection_as_string (WebKitDOMDOMSelection *selection)
return string;
}
#pragma GCC diagnostic pop
......@@ -44,6 +44,9 @@
#include <webkit2/webkit-web-extension.h>
#include <JavaScriptCore/JavaScript.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
struct _EphyWebExtension {
GObject parent_instance;
......@@ -108,47 +111,6 @@ static const char introspection_xml[] =
G_DEFINE_TYPE (EphyWebExtension, ephy_web_extension, G_TYPE_OBJECT)
static gboolean
should_use_https_everywhere (const char *request_uri,
const char *redirected_uri)
{
#if ENABLE_HTTPS_EVERYWHERE
SoupURI *request_soup_uri;
SoupURI *redirected_soup_uri;
gboolean result = TRUE;
request_soup_uri = soup_uri_new (request_uri);
if (request_soup_uri->scheme != SOUP_URI_SCHEME_HTTP) {
soup_uri_free (request_soup_uri);
return FALSE;
}
if (!redirected_uri) {
soup_uri_free (request_soup_uri);
return TRUE;
}
redirected_soup_uri = soup_uri_new (redirected_uri);
if (request_soup_uri->scheme == SOUP_URI_SCHEME_HTTP &&
redirected_soup_uri->scheme == SOUP_URI_SCHEME_HTTPS) {
/* If the server redirected us from an https:// URI to an http:// URI, we'd
* better not try to use HTTPS Everywhere as it'll just be a redirect loop.
* So now we compare ignoring scheme and port.... */
redirected_soup_uri->scheme = SOUP_URI_SCHEME_HTTP;
redirected_soup_uri->port = request_soup_uri->port;
result = !soup_uri_equal (request_soup_uri, redirected_soup_uri);
}
soup_uri_free (request_soup_uri);
soup_uri_free (redirected_soup_uri);
return result;
#else
return FALSE;
#endif
}
static gboolean
should_use_adblocker (const char *request_uri,
const char *page_uri,
......@@ -196,15 +158,11 @@ web_page_send_request (WebKitWebPage *web_page,
const char *redirected_response_uri;
const char *page_uri;
char *modified_uri = NULL;
EphyUriTestFlags flags = EPHY_URI_TEST_ALL;
request_uri = webkit_uri_request_get_uri (request);
page_uri = webkit_web_page_get_uri (web_page);
redirected_response_uri = redirected_response ? webkit_uri_response_get_uri (redirected_response) : NULL;
if (!should_use_adblocker (request_uri, page_uri, redirected_response_uri))
flags &= ~EPHY_URI_TEST_ADBLOCK;
if (g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DO_NOT_TRACK)) {
SoupMessageHeaders *headers = webkit_uri_request_get_http_headers (request);
if (headers) {
......@@ -215,16 +173,13 @@ web_page_send_request (WebKitWebPage *web_page,
modified_uri = ephy_remove_tracking_from_uri (request_uri);
}
if (!should_use_https_everywhere (request_uri, redirected_response_uri))
flags &= ~EPHY_URI_TEST_HTTPS_EVERYWHERE;
if ((flags & EPHY_URI_TEST_ADBLOCK) || (flags & EPHY_URI_TEST_HTTPS_EVERYWHERE)) {
if (should_use_adblocker (request_uri, page_uri, redirected_response_uri)) {
char *result;
ephy_uri_tester_load (extension->uri_tester);
result = ephy_uri_tester_rewrite_uri (extension->uri_tester,
modified_uri ? modified_uri : request_uri,
page_uri, flags);
page_uri);
g_free (modified_uri);
if (!result) {
......@@ -272,14 +227,10 @@ form_auth_data_save_request_new_id (void)
static void
store_password (EphyEmbedFormAuth *form_auth)
{
SoupURI *uri;
char *uri_str;
char *origin;
char *username_field_name = NULL;
char *password_field_name = NULL;
const char *username = NULL;
const char *password = NULL;
const char *target_origin;
gboolean password_updated;
WebKitDOMNode *username_node;
EphyWebExtension *extension = ephy_web_extension_get ();
......@@ -298,22 +249,16 @@ store_password (EphyEmbedFormAuth *form_auth)
NULL);
password = ephy_embed_form_auth_get_password (form_auth);
uri = ephy_embed_form_auth_get_uri (form_auth);
uri_str = soup_uri_to_string (uri, FALSE);
origin = ephy_uri_to_security_origin (uri_str);
target_origin = ephy_embed_form_auth_get_target_origin (form_auth);
password_updated = ephy_embed_form_auth_get_password_updated (form_auth);
ephy_password_manager_save (extension->password_manager,
origin,
target_origin,
ephy_embed_form_auth_get_origin (form_auth),
ephy_embed_form_auth_get_target_origin (form_auth),
username,
password,
username_field_name,
password_field_name,
!password_updated);
g_free (uri_str);
g_free (origin);
g_free (username_field_name);
g_free (password_field_name);
}
......@@ -323,27 +268,15 @@ request_decision_on_storing (EphyEmbedFormAuth *form_auth)
{
char *username_field_value = NULL;
guint request_id;
SoupURI *uri;
WebKitDOMNode *username_node;
WebKitDOMDOMWindow *dom_window = NULL;
GVariant *variant;
char *message = NULL;
char *uri_string = NULL;
char *origin = NULL;
dom_window = webkit_dom_document_get_default_view (ephy_embed_form_auth_get_owner_document (form_auth));
if (dom_window == NULL)
goto out;
uri = ephy_embed_form_auth_get_uri (form_auth);
if (uri == NULL)
goto out;
uri_string = soup_uri_to_string (uri, FALSE);
origin = ephy_uri_to_security_origin (uri_string);
if (origin == NULL)
goto out;
request_id = form_auth_data_save_request_new_id ();
username_node = ephy_embed_form_auth_get_username_node (form_auth);
......@@ -353,7 +286,7 @@ request_decision_on_storing (EphyEmbedFormAuth *form_auth)
variant = g_variant_new ("(utss)",
request_id,
ephy_embed_form_auth_get_page_id (form_auth),
origin,
ephy_embed_form_auth_get_origin (form_auth),
username_field_value ? username_field_value : "");
g_free (username_field_value);
......@@ -373,12 +306,7 @@ out:
g_object_unref (dom_window);
if (form_auth != NULL)
g_object_unref (form_auth);
if (message != NULL)
g_free (message);
if (uri_string != NULL)
g_free (uri_string);
if (origin != NULL)
g_free (origin);
g_free (message);
}
static void
......@@ -388,23 +316,15 @@ should_store_cb (GList *records,
EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (user_data);
EphyWebExtension *web_extension;
EphyPermission permission;
SoupURI *uri;
char *uri_string;
const char *password;
char *origin = NULL;
uri = ephy_embed_form_auth_get_uri (form_auth);
uri_string = soup_uri_to_string (uri, FALSE);
if (uri_string == NULL)
if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_REMEMBER_PASSWORDS))
return;
origin = ephy_uri_to_security_origin (uri_string);
if (origin == NULL)
goto out;
web_extension = ephy_web_extension_get ();
permission = ephy_permissions_manager_get_permission (web_extension->permissions_manager,
EPHY_PERMISSION_TYPE_SAVE_PASSWORD,
origin);
ephy_embed_form_auth_get_origin (form_auth));
if (permission == EPHY_PERMISSION_DENY) {
LOG ("User/password storage permission previously denied. Not asking about storing.");
......@@ -447,9 +367,6 @@ should_store_cb (GList *records,
}
out:
if (origin != NULL)
g_free (origin);
g_free (uri_string);
g_object_unref (form_auth);
g_list_free_full (records, g_object_unref);
}
......@@ -460,17 +377,13 @@ handle_form_submission (WebKitWebPage *web_page,
{
EphyWebExtension *extension = ephy_web_extension_get ();
EphyEmbedFormAuth *form_auth;
SoupURI *uri;
char *target_origin;
WebKitDOMNode *username_node = NULL;
WebKitDOMNode *password_node = NULL;
char *username_field_name = NULL;
char *username_field_value = NULL;
char *password_field_name = NULL;
char *password_field_value = NULL;
char *uri_str;
char *origin;
char *form_action;
char *form_action = NULL;
if (!extension->password_manager)
return;
......@@ -482,53 +395,50 @@ handle_form_submission (WebKitWebPage *web_page,
return;
if (username_node) {
g_object_get (username_node,
"name", &username_field_name,
NULL);
g_object_get (username_node,
"value", &username_field_value,
NULL);
}
g_object_get (password_node,
"name", &password_field_name,
NULL);
g_object_get (password_node,
"value", &password_field_value,
NULL);
form_action = webkit_dom_html_form_element_get_action (dom_form);
if (form_action == NULL)
form_action = g_strdup (webkit_web_page_get_uri (web_page));
target_origin = ephy_uri_to_security_origin (form_action);
/* EphyEmbedFormAuth takes ownership of the nodes */
form_auth = ephy_embed_form_auth_new (web_page,
target_origin,
form_action,
username_node,
password_node,
username_field_value,
password_field_value);
uri = ephy_embed_form_auth_get_uri (form_auth);
soup_uri_set_query (uri, NULL);
if (username_node)
g_object_get (username_node, "name", &username_field_name, NULL);
g_object_get (password_node, "name", &password_field_name, NULL);
uri_str = soup_uri_to_string (uri, FALSE);
origin = ephy_uri_to_security_origin (uri_str);
ephy_password_manager_query (extension->password_manager,
NULL,
origin,