From ca8a51c4bbb7709aee429a980313a19ec34bf942 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 7 Mar 2020 11:51:23 +0200 Subject: [PATCH] webkit2: Fix http://localhost:12345/ redirect handling The resource-load-started cannot be used to replace the older resource-request-starting signal and as such, the final redirect to the special http://localhost:12345/ URL did not work. Use the decide-policy signal for navigation action instead. Also remove the attempt to modify the request URI from resource-load-started since that is not going to work either. This is not really critical for functionality, but could eventually be replaced with a handler for the WebKitWebPage send-request signal. Signed-off-by: Jouni Malinen --- src/utils/browser.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/utils/browser.c b/src/utils/browser.c index f864fbf0e..c0f4380c4 100644 --- a/src/utils/browser.c +++ b/src/utils/browser.c @@ -107,9 +107,6 @@ static void view_cb_resource_load_starting(WebKitWebView *view, const gchar *uri = webkit_uri_request_get_uri(req); wpa_printf(MSG_DEBUG, "BROWSER:%s uri=%s", __func__, uri); - if (g_str_has_suffix(uri, "/favicon.ico")) - webkit_uri_request_set_uri(req, "about:blank"); - process_request_starting_uri(ctx, uri); } @@ -134,6 +131,21 @@ static gboolean view_cb_decide_policy(WebKitWebView *view, } break; } + case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: { + WebKitNavigationPolicyDecision *d; + WebKitNavigationAction *a; + WebKitURIRequest *req; + const gchar *uri; + + d = WEBKIT_NAVIGATION_POLICY_DECISION(policy); + a = webkit_navigation_policy_decision_get_navigation_action(d); + req = webkit_navigation_action_get_request(a); + uri = webkit_uri_request_get_uri(req); + wpa_printf(MSG_DEBUG, "BROWSER:%s navigation action: uri=%s", + __func__, uri); + process_request_starting_uri(ctx, uri); + break; + } default: break; }