[webkit-gtk] Ignoring form submission doesn't work in 2.14

Vasiliy Faronov vfaronov at gmail.com
Fri Jan 13 05:10:44 PST 2017


I have a Python program that uses WebKitGTK+ (via
GObject-Introspection) to create a WebView, populate it with an HTML
form, and handle submissions of that form.

See: https://gist.github.com/vfaronov/f1c1faa969c58b5990d02f5d9890b180

After my Python code has handled the submission, I want WebKit to stop
its further processing: it must *not* navigate away to the form's

To accomplish this, I keep references to the submission requests, as
suggested by the docs for the submit-form signal [1]. This works for
me with WebKitGTK+ 2.10 and 2.12.

But with 2.14.2, the WebView "freezes" after my on_submit_form
callback returns. That is, after clicking the "Submit" button, it
stays visually pressed down, and I can no longer scroll the view or
type in the input field. However, if I click the "Submit" button again
in this "frozen" state, my callback is called again and produces the
same output. And if I right-click in the WebView, the context menu
still pops up.

Of course, if I don't keep the reference -- that is, if I remove
"refs.append(request)" -- then the WebView navigates away to the form
target (about:blank), which is what I want to *prevent*.

Any idea why my code breaks with 2.14? Maybe there's a better way to
do what I want?

Thank you.

[1] https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#WebKitWebView-submit-form


More information about the webkit-gtk mailing list