Bug#931807: libwebkit2gtk-4.0-37: JavaScript code fails without error message on ppc64el and s390x

2019-07-12 Thread Alberto Garcia
Control: reassign -1 libjavascriptcoregtk-4.0-18 2.24.3-1
Control: retitle -1 libjavascriptcoregtk-4.0-18: segfaults on powerpc64 and 
s390x

On Wed, Jul 10, 2019 at 09:54:59PM +0300, Dmitry Shachnev wrote:
>   for (var i = 0; i < 2; i++) {
> var foo = {};
> foo.bar = null;
>   }

Thank you very much for the test case. I can reproduce the bug easily
by saving that code to a file and running it with /usr/bin/jsc

Berto



Bug#931807: libwebkit2gtk-4.0-37: JavaScript code fails without error message on ppc64el and s390x

2019-07-10 Thread Dmitry Shachnev
On Wed, Jul 10, 2019 at 07:10:27PM +0300, Dmitry Shachnev wrote:
> 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).

After several hours of debugging, I was able to trim the HTML to the
following:

  
  

  
  for (var i = 0; i < 2; i++) {
var foo = {};
foo.bar = null;
  }
  



  

To reproduce, save this to test.html and in my test.c, replace the URL
with file:///path/to/test.html.

In case of Sphinx, the following code in jQuery broke it:

  jQuery.each( {
  margin: "",
  padding: "",
  border: "Width"
  }, function( prefix, suffix ) {
  jQuery.cssHooks[ prefix + suffix ] = {
  ...
  };

  if ( prefix !== "margin" ) {
  jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  }
  } );

--
Dmitry Shachnev


signature.asc
Description: PGP signature


Bug#931807: libwebkit2gtk-4.0-37: JavaScript code fails without error message on ppc64el and s390x

2019-07-10 Thread Dmitry Shachnev
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 
#include 

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, );
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(, );

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;
}


signature.asc
Description: PGP signature