Bug 16654

Summary: [GTK] Signal "navigation-requested" does not react correctly on return TRUE from callbacks
Product: WebKit Reporter: Lars Strojny <lars>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: alp, xan.lopez
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
WebKitNavigationResponse accumulator. alp: review+

Lars Strojny
Reported 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.
Attachments
WebKitNavigationResponse accumulator. (3.00 KB, patch)
2007-12-30 09:29 PST, Xan Lopez
alp: review+
Xan Lopez
Comment 1 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.
Xan Lopez
Comment 2 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?
Xan Lopez
Comment 3 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(-)
Alp Toker
Comment 4 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.
Xan Lopez
Comment 5 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.
Alp Toker
Comment 6 2008-01-03 22:30:40 PST
Comment on attachment 18193 [details] WebKitNavigationResponse accumulator. Fair enough. r=me
Alp Toker
Comment 7 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!)
Note You need to log in before you can comment on or make changes to this bug.