david-dick / firefox-marionette

This is a client module to automate the Mozilla Firefox browser via the Marionette protocol
https://metacpan.org/dist/Firefox-Marionette
Other
12 stars 3 forks source link

moz:headless has not been determined correctly #29

Closed 532910 closed 10 months ago

532910 commented 10 months ago

moz:headless has not been determined correctly

The module was unable to correctly determine whether Firefox is running in "headless" or not. This is probably a bug in this module's logic. Please report as described in the BUGS AND LIMITATIONS section below.

Adding

    Carp::carp( '1 ' . $parameters->{'moz:headless'} );
    Carp::carp( '2 ' . JSON::is_bool( $parameters->{'moz:headless'} ) );
    Carp::carp( '3 ' . Dumper( $parameters->{'moz:headless'} ) );

before if ( defined $parameters->{'moz:headless'} ) { in the _create_capabilities quite often gives:

1 0 at ... line 37.
2 1 at ... line 37.
3 $VAR1 = bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' );
 at ... line 37.

though other times it gives: two ones in the first two positions.

But this happens only from mason application: I can't reproduce this calling Firefox::Marionette->new manually.

532910 commented 10 months ago

https://www.robertprice.co.uk/robblog/parsing_json_boolean_values_with_perl-shtml/

david-dick commented 10 months ago

yikes. what version of JSON::XS, JSON::PP and JSON are you running?

david-dick commented 10 months ago

Seems like a lot of work has been done on boolean handling in JSON::PP recently

david-dick commented 10 months ago

Any chance of being able to insert Carp::carp( '4 ' . $JSON::PP::VERSION ); into your code above and send the results?

532910 commented 10 months ago

$JSON::PP::VERSION is undef:

Use of uninitialized value $JSON::PP::VERSION in concatenation (.) or string at /usr/share/perl5/Firefox/Marionette.pm line 6904.
% dpkg -l | grep json
ii  libcpanel-json-xs-perl:amd64          4.35-1                         amd64        module for fast and correct serialising to JSON
ii  libjson-c5:amd64                      0.16-2                         amd64        JSON manipulation library - shared library
ii  libjson-maybexs-perl                  1.004004-1                     all          interface to the best available JSON module
ii  libjson-perl                          4.10000-1                      all          module for manipulating JSON-formatted data
ii  libjson-xs-perl                       4.030-2+b1                     amd64        module for manipulating JSON-formatted data (C/XS-accelerated)
david-dick commented 10 months ago

Thanks for the patch!