Bug 181041
Summary: | [GTK] WebView create signal: navigation action modifiers not set | ||
---|---|---|---|
Product: | WebKit | Reporter: | Cédric Bellegarde <cedric.bellegarde> |
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | bugs-noreply, mcatanzaro |
Priority: | P2 | ||
Version: | Other | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Cédric Bellegarde
While holding Ctrl or Shift key while a page is created via create signal, the navigation action modifiers are not set.
This code always print "0":
def on_create(related, navigation_action):
print(navigation_action.get_modifiers())
webview.connect("create", on_create)
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Michael Catanzaro
The C API works perfectly fine for me, in trunk.
An introspection issue seems unlikely, since this is just a simple unsigned int.
Cédric Bellegarde
No the C API does not work, here a patch for epiphany tags/3.26.5.1:
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 195ec9814..a9d71f7c5 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1842,6 +1842,7 @@ create_web_view_cb (WebKitWebView *web_view,
EphyNewTabFlags flags;
EphyWindow *target_window;
+ printf("create_web_view_cb(): %d\n", webkit_navigation_action_get_modifiers(navigation_action));
if ((ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) != EPHY_EMBED_SHELL_MODE_APPLICATION) &&
(g_settings_get_boolean (EPHY_SETTINGS_MAIN,
EPHY_PREFS_NEW_WINDOWS_IN_TABS) ||
Go to https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_open, click on try it with Shift pressed, it will always print "0"
Cédric Bellegarde
Can you test above patch with trunk to confirm it's fixed?
Michael Catanzaro
(In reply to Cédric Bellegarde from comment #3)
> Can you test above patch with trunk to confirm it's fixed?
Ah, you're thinking like me... that's almost exactly what I did to test yesterday. I used g_warning instead of printf (it's a bit more visible, and you don't need to write the \n), and I used __FUNCTION__ instead of writing out the function name in the printf... and I used w3school's tab opening example https://www.w3schools.com/howto/tryit.asp?filename=tryhow_js_tabs instead of their window opening example. Eerie.
That particular page is actually broken in trunk: none of the JS there seems to run. But you can test on https://www.w3schools.com/jsref/met_win_open.asp instead, by clicking on the Try it Yourself button. Shift+click is not going to work, because that triggers a download from navigation policy; it'll never rearch create_web_view_cb. But when I Alt+click I see it print 8.
Cédric Bellegarde
Ok, thanks, I would have tested my self but webkit 2.19 make gcc to segfault on ArchLinux :/
Cédric Bellegarde
Not fixed by 2.19.92
>when I Alt+click I see it print 8.
Mee too
Now do the same with the "Try it" button, I see 0.
Cédric Bellegarde
It is working with WebKitGTK 2.23.91!