Corion / WWW-Mechanize-Chrome

automate the Chrome browser

Home Page:https://metacpan.org/release/WWW-Mechanize-Chrome

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

->update_html halts

KES777 opened this issue · comments

I have next Mojolicious helper:

sub html2pdf {
	my $chrome =  shift->chrome;
	my $html =  shift;
	$chrome->update_html( $html );
	return $chrome->content_as_pdf( format => 'A4' );
}

it halts execution of script, but if I provide string to update_html method, then works fine:

$chrome->update_html( $html );

How to reproduce:

$html = '<b>Hi</b>';
$chrome->update_html( "$html" ); # works
$chrome->update_html(  $html  ); # halted

Most likely, Mojolicious returns an object instead of a plain string. ->update_html wants a string and you've already found a workaround. I'll add a proper test and fix for this issue, by always stringifying the argument to ->update_html.

This is not mojolicious. See how to reproduce. Here $html is not object

Hmm - but the above code is already how it is tested in https://github.com/Corion/WWW-Mechanize-Chrome/blob/master/t/51-mech-set-content.t (the currently only test). Does that test pass for you?

I'll add your test case to that file as well, but I don't see how it is different. If you can please add a short program like t/51-mech-set-content.t to this ticket, and the Chrome version and the module versions as t/00-load.t outputs, then I can maybe replicate the problem.

Also, running the script with logging initialized to $TRACE instead of $ERROR maybe shows where the problems start.

Is this issue still open? I've added tests and they always pass for me.

I can not reproduce the issue on 0.44 version

For reference: commit: 77877ee