in reply to Re^6: RemoteObject.pm fails in open firefox8.0
in thread RemoteObject.pm fails in open firefox8.0
I got some findings, here is the code:
sub js_call_to_perl_struct { my ($self,$js,$context) = @_; $context ||= ''; $self->{stats}->{roundtrip}++; my $repl = $self->repl; if (! $repl) { # Likely during global destruction return }; my $queue = join '', map( { /;$/? $_ : "$_;" } map { s/\s*$//; $_ } @{ + $self->queue }); @{ $self->queue } = (); #warn "<<$js>>"; my @js; if ($queue) { push @js, $self->repl_API('q', $queue); }; push @js, $self->repl_API('ejs', $js, $context ); $js = join ";", @js; if (defined wantarray) { #warn $js; # When going async, we would want to turn this into a callback my $res = $self->execute_command($js); $res =~ s/^(?:\.+\>\s+)+//g; while ($res !~ /\S/) { # Gobble up continuation prompts warn "No result yet from repl"; $res = $self->execute_command(";"); # no-op $res =~ s/^(?:\.+\>\s+)+//g; }; my $d = $self->to_perl($res); if ($d->{status} eq 'ok') { return $d->{result} } else { croak ((ref $self).": $d->{name}: $d->{message}"); }; } else { #warn "Executing $js"; # When going async, we would want to turn this into a callback # This produces additional, bogus prompts... $self->execute_command($js); () }; };
Where in the code :
$js is:my $res = $self->execute_command($js);
In firefox7.0, after command execution, the return value $res is:repl.ejs(" var f=function() {\n var wm = Components.classes[\"@mozilla.org/appshell/window-mediator;1\ +"]\n.getService(Components.interfaces.nsIWindowMediator);\n var win = wm.getMostRecentWindow('navigator:browser');\n if (! win) {\n// No browser windows are open, so open a new one.\n + win = window.open('about:blank');\n };\n return win.getBrowser()\n }\n;\n; f","" );
"{"status":"ok", "result":{"result":1,"type":"function"} }"
But in firefox 8,it returns something different: "8.0!"?!? Thats why it fails always. Any solutions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: RemoteObject.pm fails in open firefox8.0
by Corion (Patriarch) on Nov 03, 2011 at 11:28 UTC |