diff options
author | Jan-Michael Brummer <jan.brummer@tabos.org> | 2019-05-03 12:03:12 +0000 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@posteo.net> | 2019-05-05 15:26:32 +0000 |
commit | 4eb452f15bdeb708c26ca5dea88eb9b4d1c4d4c9 (patch) | |
tree | ede4b52114ccb9a29f083d54bad418880b2dd0ed | |
parent | 44c9eab547134f08a9da1c1631c258f3d768f5d2 (diff) | |
download | epiphany-4eb452f15bdeb708c26ca5dea88eb9b4d1c4d4c9.tar.gz |
Remove referrer in ephy_web_application_is_uri_allowed () and use webapp url directly
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/558
(cherry picked from commit 8b76f3f1e3099c4fd37d081488613cc802f13e8c)
-rw-r--r-- | lib/ephy-web-app-utils.c | 6 | ||||
-rw-r--r-- | lib/ephy-web-app-utils.h | 2 | ||||
-rw-r--r-- | src/ephy-window.c | 19 |
3 files changed, 6 insertions, 21 deletions
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c index 63596f0b9..684b84a58 100644 --- a/lib/ephy-web-app-utils.c +++ b/lib/ephy-web-app-utils.c @@ -782,9 +782,9 @@ urls_have_same_origin (const char *a_url, } gboolean -ephy_web_application_is_uri_allowed (const char *uri, - const char *referrer) +ephy_web_application_is_uri_allowed (const char *uri) { + EphyWebApplication *webapp = ephy_web_application_for_profile_directory (ephy_profile_dir ()); SoupURI *request_uri; char **urls; guint i; @@ -793,7 +793,7 @@ ephy_web_application_is_uri_allowed (const char *uri, if (g_str_has_prefix (uri, "blob:") || g_str_has_prefix (uri, "data:")) return TRUE; - if (urls_have_same_origin (uri, referrer)) + if (urls_have_same_origin (uri, webapp->url)) return TRUE; if (g_strcmp0 (uri, "about:blank") == 0) diff --git a/lib/ephy-web-app-utils.h b/lib/ephy-web-app-utils.h index 3080f9970..1d436858c 100644 --- a/lib/ephy-web-app-utils.h +++ b/lib/ephy-web-app-utils.h @@ -67,7 +67,7 @@ void ephy_web_application_free_application_list (GList *list); void ephy_web_application_initialize_settings (const char *profile_directory); -gboolean ephy_web_application_is_uri_allowed (const char *uri, const char *referrer); +gboolean ephy_web_application_is_uri_allowed (const char *uri); gboolean ephy_web_application_save (EphyWebApplication *app); diff --git a/src/ephy-window.c b/src/ephy-window.c index 2724dbdb5..236b7d55f 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1896,17 +1896,6 @@ web_view_ready_cb (WebKitWebView *web_view, g_signal_emit_by_name (parent_web_view, "new-window", web_view); } - if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION && - !webkit_web_view_get_uri (web_view)) { - /* Wait until we have a valid URL to decide whether to show the window - * or load the URL in the default web browser - */ - g_object_set_data_full (G_OBJECT (window), "referrer", - g_strdup (webkit_web_view_get_uri (parent_web_view)), - g_free); - return TRUE; - } - gtk_widget_show (GTK_WIDGET (window)); return TRUE; @@ -2040,11 +2029,7 @@ decide_navigation_policy (WebKitWebView *web_view, if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION) { if (!gtk_widget_is_visible (GTK_WIDGET (window))) { - char *referrer; - - referrer = (char *)g_object_get_data (G_OBJECT (window), "referrer"); - - if (ephy_web_application_is_uri_allowed (uri, referrer)) { + if (ephy_web_application_is_uri_allowed (uri)) { gtk_widget_show (GTK_WIDGET (window)); } else { /* We can't get here under flatpak because this code only @@ -2063,7 +2048,7 @@ decide_navigation_policy (WebKitWebView *web_view, if (navigation_type == WEBKIT_NAVIGATION_TYPE_LINK_CLICKED || (navigation_type == WEBKIT_NAVIGATION_TYPE_OTHER && webkit_navigation_action_is_user_gesture (navigation_action))) { - if (ephy_web_application_is_uri_allowed (uri, webkit_web_view_get_uri (web_view))) + if (ephy_web_application_is_uri_allowed (uri)) return FALSE; /* We can't get here under flatpak because this code only |