Coder Social home page Coder Social logo

mozrepl's Introduction

MozRepl Build Status

Important Notice

Key technologies upon which MozRepl depends will be retired from the Mozilla platform in November 2017. If you are relying on MozRepl, please investigate migration paths. The last known compatible version is Firefox 54.

What is it

MozRepl is an extension for Firefox and other Mozilla applications. It listens on a TCP port for connections (by default localhost only) and responds with a shell where you can evaluate JavaScript code, in the browser context as well as in web pages.

Demo

http://www.youtube.com/watch?v=5RSnHN6S52c

Documentation

https://github.com/bard/mozrepl/wiki

mozrepl's People

Contributors

bard avatar d-faure avatar erjoalgo avatar iyshannon avatar milouse avatar notethan avatar rpl avatar unhammer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mozrepl's Issues

firefox 4.0 compatibility

Hi,

MozRepl is an indispensable tool for hacking webapps and js. However I'm using firefox 4.0b6 now.

Any plans to make it 4.0 compatible?

repl gets cleared after entering content

Please look at the below interaction.

  • I have repl
  • repl.enter shows as a function
  • I enter content
  • repl.enter... no more
  • repl... still prints that it has something
repl> repl
[object Object] - {onOutput: function() {...}, onQuit: function() {...}, _name: "repl", ...}
repl> repl.enter
function() {...}
repl> repl.enter(content)
[object Window] - {window: {...}, document: {...}, navigator: {...}, location: {...}, ...}
repl> repl.enter
repl> repl
[object Object] - {onOutput: function() {...}, onQuit: function() {...}, _name: "repl", ...}
repl> 

What could I be doing wrong here, let me know, please.
This happens only with some pages... but it consistently happens with those pages.

repl.doc() opens bad URL

This part of the tutorial:
repl> var c = document.getElementById('urlbar-container')
repl> repl.enter(c)
repl> repl.doc(firstChild)
opens a page at "XUL Planet", which reads:
XUL Planet

After much thought and consideration, we have determined to close the XUL Planet site. Please use https://developer.mozilla.org/En/XUL instead.

Thanks for all your support over the years. 
    - Neil Deakin and Aaron Andersen

MOZREPL and Vista and XP

With Vista or XP French version MOZREPL and autoit doesn't works. We can't do any automation. Instead of opening a website it's open www.4242.com and nothing walk. I works with Firefox 10.0 French version

If i try with windows 7 all is perfect and i can do what i want to automate

I use MOZREPL 1.1

Where is it in Firefox 29?

The user interface of Firefox 29 has changed drastically and I don't find where to enable MozRepl. Does anyone know where it is? Thanks.

Edit: in the add-on list I have no "Preferences" button next to this add-on.

Start the repl on Windows?

What is the proper command line format to start the repl for Firefox on Windows? Do I need double quotes around the option and port, like "-repl 4242"?

node.js module please?

nodejs module where we can connect and then start using the remote objects directly as if local?

var moz = require('mozrepl');
var conn1 = moz.connect('127.0.0.1' , '4747');
var conn2 = moz.connect('127.0.0.1' , '4748');

var gbrwoser1; var gbrowser2;

if (conn.connected=true){
gbrowser1=conn1.otherEnd.content;
}

if (conn2.connected=true){
gbrowser2=conn2.otherEnd.content;
}

//start using "window" of the other end as if its local.
if (gBrowser1.location.href == gBrowser2..location.href) {
gBrowser1.alert('hey! the other browser has the same page open .');
gBrowser2.alert('hey! the other browser has the same page open .');
}

Firefox 5 capability problem

The latest one MozRepl 1.1beta2 is not compatible with firefox 5.0(eg:5.0b7), do you have a plan how to support this? And the coming firefox 6, 7 ,8...since Mozilla speeds up releases?

Firefox nightly compability?

Well nightly at this moment is at 8.0a1.

I don't really know if it works or not, but applications that I've used it for don't work anymore..

I use keeform plugin for keepass..

Maybe the problem is on my side, but it worked great on 7.0 version of nightly...

If you can look it up!

Thanks in advance

Feature request: REPL for add-on debugging

I'm developing a firefox add-on and I'd like to be able to run this repl within the context of the add-on. So far, the only way I know to run js code within the add-on is by starting firefox with the add-on enabled, go to the addons page, clicking Debug, accepting the prompt to start a remote-debugging request, setting a breakpoint, then using the browser in a way that triggers the breakpoint. Then I can go to the console tab of the remote-debugging window and I'm in the add-on context.
Naturally, all this clicking and hoops are very slow and frustrating and I'd like to start a repl programmatically, something like:
/usr/bin/firefox -profile /path/to/profile/folder -repl -repl 7070

as pointed out in the docs https://github.com/bard/mozrepl/wiki/Starting-the-REPL

However, mozrepl only seems to run in the context of the browser. Is there a way to specify a specific add-on to attach a repl as a debugger? Any pointers for implementing this feature?

Firefox 7 seems not compatible

Seems Firefox 7 not compatible but firefox 6 has no problem?

This exception always happens:
command timed-out at C:/Perl/site/lib/MozRepl/Client.pm line 186.

While checking line 186 code:

sub execute{
....

my $message =[map {chomp; $_} $self->telnet->cmd(String => $command)];
....
}

Can you debug?

Outside connections do not work

Hi,

This is the same as in the #24. I do not have the rights to reopen the issue, so I created this new one. Sorry for the mess.

The connection problem still exists. I've tested on FF 10 on RedHat, FF 11 on Win7, FF 11 on Ubuntu with Mozrepl 1.1, and still can not connect from anywhere except from localhost.

We have discovered this issue when the Firefox installation our servers are automatically updated to 10 (we were using 3). We have reverted back to FF 3 and Mozrepl 1.0 as a workaround.

No longer supports Thunderbird

Trying to start it on the 9/26 Thunderbird Daily gives the error:
Error: TypeError: server is undefined
Source file: chrome://mozlab/content/mozrepl/overlay_impl.js Line: 60

websocket mode

how about replacing (or adding to) the ancient, text-based telnet protocol with websockets?

websockets have a concept of messages, so a command and response don’t ahve to be parsed from a text stream, but are simply sent and received with ws.send() and ws.onmessage.

only disadavantage is that a shell isn’t simply “rlwrap telnet host port”.

Execute javascript in current web page context

How would can I execute javascript in the currently loaded page via the repl?

# load https://example.com
repl> content.location.href = 'https://example.com'

# say that example.com exposes a global function called pageStatus(),
# how do I call that function and get the results back in the repl
repl> content.window.pageStatus() 
// returns !!! TypeError: content.window.pageStatus is not a function

Loading the page in firefox and using the developer tools console I can execute any of the following correctly

window.pageStatus()
content.pageStatus()
content.window.pageStatus()
pageStatus()

ReferenceError: gBrowser not defined

Hello,

after working a while with mozrepl (after sending around 100 commands or so) I get this error. IMHO gBrowser in Firefox should never be not defined. Has anybody else seen this?

thx

repl> gBrowser
!!! ReferenceError: gBrowser is not defined

Details:

message: gBrowser is not defined
fileName: chrome://mozrepl/content/repl.js -> file:///home/worker/.mozilla/firefox/qghih3uu.dev/mozrepl.tmp.js
lineNumber: 1
stack:
@chrome://mozrepl/content/repl.js -> file:///home/worker/.mozilla/firefox/qghih3uu.dev/mozrepl.tmp.js:1
name: ReferenceError

Limits for number of lines when loading a function

when sending a function definition to Firefox using mozrepl and Autoit/FF.au3 it seems that sending too many lines defining a function causes an error: __FFWaitForRepl ==> Error return value: MozRepl ....>

Are there any limits to observe?

Because I am a newbie I ask for help, e.g. for loading the js-file directly in e.g. telnet and getting a more meaningfull error reply

THANX
basko

mozilla 8.0 + autoit

Hi, my programs in autoit works in ff 7 but it isnt in 8. Where is the problem? Mozilla.mozrepl or autoit?

BB And thx

Connect fails under OS X when no top-level window open

diff --git a/chrome/content/server.js b/chrome/content/server.js
index fdfa2a8..cdbbf63 100644
--- a/chrome/content/server.js
+++ b/chrome/content/server.js
@@ -121,6 +121,13 @@ function onSocketAccepted(serv, transport) {
.getService(Ci.nsIWindowMediator)
.getMostRecentWindow(typeof(contextWindowType) !== 'undefined' ?
contextWindowType : pref.getCharPref('startingContext'));
+

  • if(context === null) {
  •    context = Cc["@mozilla.org/appshell/appShellService;1"]
    
  •        .getService(Ci.nsIAppShellService)
    
  •        .hiddenDOMWindow.wrappedJSObject;
    
  • }
  • var session = new REPL();
    session.onOutput = function(string) {
    outstream.write(string, string.length);

Firebug is the active context

Hi,

when I opened Firebug as a separate window and connect to the repl, Firebug will be the active context. How can I skip the Firebug context?

repl> repl.whereAmI();
[object ChromeWindow] - Document title: "Firebug - inaktiv für die aktuelle Webseite"

"pattern match read eof" using perl with MozRepl

dearest MozRepl wizards

I have been using MozRepl with perl quite happily on my previous linux install.
I recently did a reinstall, at the same time upgrading to ubuntu 10.10 - and initially I tried the 64 bit version.I got strange errors using my old perl code with MozRepl (never seen these errors before, and no change to the code), and thinking it was the fault of the 64 bit o/s I reinstalled again on the 32 bit version of 10.10. But it didn't help - I still get the errors.

What errors? My code iterates through a list of websites extracting and saving the info. It makes its requests through WWW::Mechanize::Firefox, and the call is simply $mech->get($url).The process works for some considerable time (50 or so requests), but then starts intermittently returning "No result yet from repl at /usr/local/share/perl/5.10.1/MozRepl /RemoteObject.pm line 676." it continues for a further random number of iterations occasionally spewing this stuff out before it finally croaks with "pattern match read eof at /usr/local/share/perl/5.10.1/MozRepl/Client.pm line 186".

I am fully aware that when something goes wrong it is usually my fault :) and so I have tried exhaustively to find the source of the error in my setup - but no luck so far (I couldn't find any noteworthy reports of this error anywhere to learn from). Could simply be a problem with my new setup. (But I have installed/reinstalled all components many times).

Or... could be a bug? Could be a bug with WWW::Mechanize::Firefox? Can anyone shed any
light?

Firefox version: 3.6.10
WWW::Mechanize::Firefox: 0.45
MozRepl: 1.0

Any help appreciated...

/RemoteObject.pm line 676." repeated a random number of times before continuing. Then after

Firefox 22.0

Hello,

I use mozrepl with autoit FF.au3.
The function : _FFDispatchEvent don't work anymore.

There are another way to make a "keydown" or "keyup" or "Keypress" ?
A clue?

Sorry but I don't know where/who ask.

ReferenceError: repl is not defined

I got this error after working a while with mozrepl.el in Emacs. From the beginning things worked fine.

I mostly send the buffer contents through something like

content.document.body.innerHTML= ... json ...

I have several Firefox windows open and several tabs in them. And I closed the tabs where the contents from mozrepl where displayed, but normally that is OK.

I am using MozRepl 1.0.0.2009122217. (What is the best way to update it?)

Latest Firefox (i.e . 3.65.3).

Here is an example of the output (below this is the first error):

repl> repl.whereAmI()
!!! ReferenceError: repl is not defined

Details:

message: repl is not defined
fileName: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/Lennart%20Borgman/Application%20Data/Mozilla/Firefox/Profiles/v6cvxnzr.default/mozrepl.tmp.js
lineNumber: 1
stack:
@chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/MyAccount/Application%20Data/Mozilla/Firefox/Profiles/v6cvxnzr.default/mozrepl.tmp.js:1
name: ReferenceError

repl>

The first error seems to be this:

!!! [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMWindowInternal.content]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/Lennart%20Borgman/Application%20Data/Mozilla/Firefox/Profiles/v6cvxnzr.default/mozrepl.tmp.js :: <TOP_LEVEL> :: line 1" data: no]

Details:

name: NS_ERROR_FAILURE
QueryInterface:
function QueryInterface() {
[native code]
}
message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMWindowInternal.content]
result: 2147500037
filename: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/Lennart%20Borgman/Application%20Data/Mozilla/Firefox/Profiles/v6cvxnzr.default/mozrepl.tmp.js
lineNumber: 1
columnNumber: 0
location: JS frame :: chrome://mozrepl/content/repl.js -> file:///C:/Documents%20and%20Settings/Lennart%20Borgman/Application%20Data/Mozilla/Firefox/Profiles/v6cvxnzr.default/mozrepl.tmp.js :: <TOP_LEVEL> :: line 1
inner: null
data: null
initialize:
function initialize() {
[native code]
}

mozilla 8.0, js caching breaks mozrepl

From Firefox/XULRunner 8.0, loadSubscript uses the startup cache to speed up repeated loading of js files. This causes a problem for Mozrepl, which uses loadSubscript on a temp file for each bit of code that was entered at the repl. Once it has been called a single time, that file's contents are cached, and all subsequent entries at the repl merely re-evaluate that first, cached entry. See the following bugzilla issue for more information.

https://bugzilla.mozilla.org/show_bug.cgi?id=648125

I had done much research into this problem for a similar situation in the web browser Conkeror, and its "evaluate" command, and the cleanest solution was to invalidate the startup cache before calling loadSubscript on the temp file. The code to do that is as follows:

var obs = Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService);
obs.notifyObservers(null, "startupcache-invalidate", null);

Or if you have imported resource://gre/modules/Services.jsm, then instead of the getService call above, you can just use Services.obs.notifyObservers(...).

The source code of Mozilla's XPIProvider.jsm also has some utils related to this.

new 1.1 ver from 13Dec dont accept outside connections

telnet 192.168.11.68 4242
Trying 192.168.11.68...
telnet: connect to address 192.168.11.68: Connection refused
telnet: Unable to connect to remote host

checkbox "Allow outside connections" is checked! how can i resolve it?

firefox 8.0.1 ver

feature request: high level "home" command in moz.el

After using repl.enter, it is frequently the case that the 'repl' object can no longer be accessed, and one is effectively stuck. Breadcrumbs seem a heavy-handed solution to the problem because they modify the environment being inspected. The solution I favor would be to have a "home" command built into the repl protocol itself. Many other repls (slime, sepia, ghci, hugs, ...) follow the convention where a comma at the start of the input denotes a repl command. So my feature request is that moz.el adopt the comma convention, and that mozrepl provide a "home" command which would change the context back to a user-configurable home scope.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.