Package: libwebkit2gtk-4.0-37
Version: 2.24.3-1

Dear Maintainer,

In Ubuntu, the autopkgtests for sphinx package started failing on ppc64el
and s390x when webkit2gtk was updated from 2.23.91 to 2.23.92, see [1]
(later they pass again, because Dimitri John Ledkov disabled the tests on
these architectures). This is not an Ubuntu-specific issue, I am just
giving a link to Ubuntu infrastucture because Debian runs autopkgtests only
on amd64.

I managed to reproduce this with C code (not Python). Attached is a test
case that is small from C point of view (trimming down the HTML part would
be more difficult).

I am compiling it and running (on a porterbox) using:

  $ gcc -O0 `pkg-config --libs --cflags webkit2gtk-4.0` test.c
  $ xvfb-run -a ./a.out

The expected output is (as happens on amd64):

  [native code]: CONSOLE LOG Test

On ppc64 and s390x, this happens instead:

  ** (a.out:56789): WARNING **: 15:38:47.789: Error running javascript: 

This happens with Sphinx' own website, and other documentation projects
generated by Sphinx (such as https://docs.python.org/3/).

I expected that in case of failure, this line would print the error case:

  g_warning ("Error running javascript: %s", error->message);

That line is copied from the documentation [2]. However the reason is empty.

[1]: https://autopkgtest.ubuntu.com/packages/sphinx/disco/s390x
[2]: 
https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebView.html#webkit-web-view-run-javascript-finish

--
Dmitry Shachnev
#include <gtk/gtk.h>
#include <webkit2/webkit2.h>

void on_javascript_finished(GObject *object, GAsyncResult *result, G_GNUC_UNUSED gpointer data) {
    WebKitJavascriptResult *js_result;
    GError *error = NULL;

    js_result = webkit_web_view_run_javascript_finish(WEBKIT_WEB_VIEW(object), result, &error);
    if (!js_result) {
        g_warning("Error running javascript: %s", error->message);
        g_error_free(error);
    }
    gtk_main_quit();
}

int print_test(gpointer data) {
    WebKitWebView *view = WEBKIT_WEB_VIEW(data);
    const gchar *script = "console.log('Test');";
    webkit_web_view_run_javascript(view, script, NULL, on_javascript_finished, NULL);
    return G_SOURCE_REMOVE;
}

int main(int argc, char **argv) {
    gtk_init(&argc, &argv);

    WebKitSettings *settings = webkit_settings_new();
    webkit_settings_set_enable_write_console_messages_to_stdout(settings, TRUE);

    WebKitWebView *view = WEBKIT_WEB_VIEW(webkit_web_view_new_with_settings(settings));
    g_object_ref(view);

    webkit_web_view_load_uri(view, "https://www.sphinx-doc.org/en/master/";);

    g_timeout_add_seconds(2, print_test, view);
    gtk_main();

    return 0;
}

Attachment: signature.asc
Description: PGP signature

Reply via email to