WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
223160
[GTK] Clicking on a custom context menu item doesn't activate action (WebExtension)
https://bugs.webkit.org/show_bug.cgi?id=223160
Summary
[GTK] Clicking on a custom context menu item doesn't activate action (WebExte...
samuel.dudik
Reported
2021-03-14 06:33:53 PDT
Clicking on a custom 'right-click' context menu item created with webkit_context_menu_item_new_from_gaction doesn't activate the specified action (no errors or warnings). This behavior only appears when using the "context-menu" signal from a WebKitWebPage (which is the only way when connecting from a WebExtension). Using it from WebKitWebView works fine. static void web_page_created_callback(WebKitWebExtension *extension, WebKitWebPage *web_page, gpointer user_data) { g_signal_connect(web_page, "context-menu", G_CALLBACK(context_menu_opened_callback), NULL); } static void open_adblock_settings(GSimpleAction *action, GVariant *parameter, gpointer user_data) { g_print("Opened settings\n"); } static gboolean context_menu_opened_callback(WebKitWebPage *web_page, WebKitContextMenu *context_menu, WebKitWebHitTestResult *hit_test_result, gpointer user_data) { g_print("Context menu opened\n"); webkit_context_menu_append(context_menu, webkit_context_menu_item_new_separator()); GSimpleAction *action = g_simple_action_new("open-settings", NULL); g_signal_connect(action, "activate", G_CALLBACK(open_adblock_settings), NULL); WebKitContextMenuItem *item = webkit_context_menu_item_new_from_gaction(G_ACTION(action), "Settings", NULL); webkit_context_menu_append(context_menu, item); return TRUE; } After clicking on the "Settings" menu item: Expected Results: "Opened settings" gets printed. Actual Results: "Opened settings" doesn't get printed. Encountered on Void Linux, WebKitGTK 2.30.5.
Attachments
Add attachment
proposed patch, testcase, etc.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug