[Webkit-unassigned] [Bug 223160] New: [GTK] Clicking on a custom context menu item doesn't activate action (WebExtension)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 14 06:33:53 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=223160

            Bug ID: 223160
           Summary: [GTK] Clicking on a custom context menu item doesn't
                    activate action (WebExtension)
           Product: WebKit
           Version: Other
          Hardware: PC
                OS: Linux
            Status: NEW
          Keywords: Gtk
          Severity: Normal
          Priority: P3
         Component: WebKitGTK
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: samuel.dudik at gmail.com
                CC: bugs-noreply at webkitgtk.org

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210314/a3b247a8/attachment.htm>


More information about the webkit-unassigned mailing list