in reply to MozRepl/Client.pm does not support firefox 7.0

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.

  • Comment on Re: MozRepl/Client.pm does not support firefox 7.0

Replies are listed 'Best First'.
Re^2: MozRepl/Client.pm does not support firefox 7.0
by seven_shen (Acolyte) on Sep 23, 2011 at 02:22 UTC

    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?

        Ouch! I'm sorry - I encountered the same issue and locally already fixed it without bumping the MozRepl::RemoteObject version and without releasing it to CPAN.

        If you're in a bind, the current version from Github should make "everything just work again", even with Firefox 7.

        The (ugly) change is that

        eval "function() {}";

        does not return an anonymous function in Javascript (on Firefox 7) anymore. The change is to use:

        eval "expr_=function() {}; expr";

        Update: Now released as v0.28 on CPAN.

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

        No, firefox 7 supports and depends on anonymous functions

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

        :) yeah, don't do that

        You're essentially changing return sub { print "call me" }; to sub named { print "call me" };

        "sub {}" returns a function, but "sub name {}" returns nothing.

        You're barking up the wrong tree :)