Bug 16654 - [GTK] Signal "navigation-requested" does not react correctly on return TRUE from callbacks
Summary: [GTK] Signal "navigation-requested" does not react correctly on return TRUE f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2007-12-28 20:18 PST by Lars Strojny
Modified: 2008-01-03 22:35 PST (History)
2 users (show)

See Also:


Attachments
WebKitNavigationResponse accumulator. (3.00 KB, patch)
2007-12-30 09:29 PST, Xan Lopez
alp: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Strojny 2007-12-28 20:18:28 PST
Signal "navigation-requested" is supposed to stop emitting the signal (and therefore the default handler should not be called). This is currently not the case. A working workround is to call g_signal_stop_emission_by_name() on the webview object.
Comment 1 Xan Lopez 2007-12-30 05:30:10 PST
What he means is that there's no way to prevent the default handler from running and returning its value unless you stop the signal manually or connect with g_signal_connect_after (making your value 'win').

I think the signal should have a boolean accumulator.
Comment 2 Xan Lopez 2007-12-30 05:46:01 PST
Obviously can't be boolean, since that's not the return type. Maybe our own ad-hoc acc?
Comment 3 Xan Lopez 2007-12-30 09:29:24 PST
Created attachment 18193 [details]
WebKitNavigationResponse accumulator.

        * WebView/webkitwebview.cpp: use our own accumulator for signals
        returning WebKitNavigationResponse. The emission will be stopped
        when any callback returns anything but
        WEBKIT_NAVIGATION_RESPONSE_ACCEPT.
---
 WebKit/gtk/ChangeLog                 |   13 +++++++++++++
 WebKit/gtk/WebView/webkitwebview.cpp |   20 +++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletions(-)
Comment 4 Alp Toker 2008-01-01 18:42:15 PST
Couldn't we just use a boolean accumulator if we defined WEBKIT_NAVIGATION_RESPONSE_ACCEPT as 0? Seems like a sensible default value.
Comment 5 Xan Lopez 2008-01-02 11:30:56 PST
Not sure if it would freak out because of the difference in types (I can check), but that would be a hack no matter how you look at it. I think our own accumulator is the right thing to do.
Comment 6 Alp Toker 2008-01-03 22:30:40 PST
Comment on attachment 18193 [details]
WebKitNavigationResponse accumulator.

Fair enough.

r=me
Comment 7 Alp Toker 2008-01-03 22:35:28 PST
Landed in r29147 with several whitespace and formatting fixes.

(I guess it was this way to match the formatting patch which wasn't accepted, so will fix up before landing, but more careful next time please!)