seven_shen has asked for the wisdom of the Perl Monks concerning the following question:

I use WWW::Mechanize::Firefox to operate latest firefox 7.0b6, The code likes:

$mech=WWW::Mechanize::Firefox->new(launch=>$ffpath,)

This works normally in Firefox 3.6,4.0,5.0,6.0, but it doesnot work with latest 7.0beta(I suppose same issue will happen when firefox 7.0 is released finally).

The problem happens in MozReply/Client.pm where the exception output is: command timed-out at C:/Perl/site/lib/MozRepl/Client.pm line 186.

I've changed mozrepl plugin manually for install.rdf to support firefox 7.0. And now the perl script stops at the above point, any solutions?

Replies are listed 'Best First'.
Re: MozRepl/Client.pm does not support firefox 7.0
by Corion (Patriarch) on Sep 20, 2011 at 06:58 UTC
    command timed-out at ...

    most likely means that there was some error in the communication between Firefox and MozRepl::Client. You can switch the logging to debug to see what the offending command is. So far, I have not tested WWW::Mechanize::Firefox against Firefox 7, so I don't know what might go wrong.

    Does the MozRepl::RemoteObject testsuite pass? Do the WWW::Mechanize::Firefox tests pass?

Re: MozRepl/Client.pm does not support firefox 7.0
by Anonymous Monk on Sep 20, 2011 at 03:48 UTC

    I've changed mozrepl plugin manually for install.rdf to support firefox 7.0. And now the perl script stops at the above point, any solutions?

    Downgrade to firefox 6 :)

Re: MozRepl/Client.pm does not support firefox 7.0
by Corion (Patriarch) on Sep 20, 2011 at 20:59 UTC

    At least for me, both, MozRepl::RemoteObject and WWW::Mechanize::Firefox pass their test suite(s) on Firefox 7 beta 5. If you have contrary findings please report them here, but it seems to be something more special to your environment than a general incompatibility.

      Really passed? At least during my try, following error comes always, seems firefox 7 does not support NONE-Name functions.

      MozRepl::RemoteObject: SyntaxError: function statement requires a name at C:/Per l/site/lib/Firefox/Application.pm line 375

      The problem never happens in before firefox releases in my platform.

        I dive out the problem might be that firefox 7 does not support anonymous functions.

        sub browser { my ($self,$repl) = @_; $repl ||= $self->repl; print "repl: $repl\n"; return $repl->declare(<<'JS')->(); function () { var wm = Components.classes["@mozilla.org/appshell/window-medi +ator;1"] .getService(Components.interfaces.nsIWindow +Mediator); var win = wm.getMostRecentWindow('navigator:browser'); if (! win) { // No browser windows are open, so open a new one. win = window.open('about:blank'); }; return win.gBrowser //return win.getBrowser() } JS }; sub declare { my ($self,$js,$context) = @_; print "1:$self; 2:$js;3:$context\n "; if (! $self->{functions}->{$js}) { $self->{functions}->{$js} = $self->expr($js); # Weaken the backlink of the function my $res = $self->{functions}->{$js}; my $ref = ref $res; bless $res, "$ref\::HashAccess"; weaken $res->{bridge}; $res->{return_context} = $context; bless $res => $ref; }; $self->{functions}->{$js} };

        If I manually change the function () to function abc(), then repl can not get any references:

        Can't bless non-reference value at C:/Perl/site/lib/MozRepl/RemoteObject.pm

        How to solve this issue?