From 4ed816d9346eed6b22ed504da97d7fb29889f4e7 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Tue, 1 Mar 2011 14:11:13 +0000 Subject: help browser open a url in same tab that would have opened in a new tab. fixes news.google.com in whitelist mode --- xxxterm.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/xxxterm.c b/xxxterm.c index 7a576f9..1860cec 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -5894,7 +5894,9 @@ webview_npd_cb(WebKitWebView *wv, WebKitWebFrame *wf, WebKitNetworkRequest *request, WebKitWebNavigationAction *na, WebKitWebPolicyDecision *pd, struct tab *t) { - char *uri; + char *uri; + WebKitWebNavigationReason reason; + struct domain *d = NULL; if (t == NULL) { show_oops_s("webview_npd_cb invalid parameters"); @@ -5914,8 +5916,22 @@ webview_npd_cb(WebKitWebView *wv, WebKitWebFrame *wf, return (TRUE); /* we made the decission */ } - webkit_web_policy_decision_use(pd); - return (TRUE); /* we made the decission */ + /* + * This is a little hairy but it comes down to this: + * when we run in whitelist mode we have to assist the browser in + * opening the URL that it would have opened in a new tab. + */ + reason = webkit_web_navigation_action_get_reason(na); + if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) { + if (enable_scripts == 0 && enable_cookie_whitelist == 1) + if (uri && (d = wl_find_uri(uri, &js_wl)) == NULL) + load_uri(t, uri); + + webkit_web_policy_decision_use(pd); + return (TRUE); /* we made the decission */ + } + + return (FALSE); } WebKitWebView * -- cgit 1.4.1-2-gfad0