Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ This is a very simple REPL for Firefox OS. It allows you to list the running app

*You will need a device running a debug version of Firefox OS with Marionette support included*

I put less than an hour into it so far. Will make much bigger improvements int he coming days.
I put less than an hour into it so far. Will make much bigger improvements in the coming days.

If you have feature requests then please submit pull requests or file a bug.

How to get it going?
====================

One time setup of a virtualenv that contains the marionette client:
(If you don't want to config the whole B2G project, please connect to
https://pypi.python.org/pypi/marionette_client/
get the most up-to-date marionette client)

```
$ virtualenv env
Expand Down Expand Up @@ -41,7 +44,7 @@ Connect to a specific app and execute commands:

```
$ source env/bin/activate
(env) $ ./fxos-repl.py connect app://gallery.gaiamobile.org/index.html
(env) $ ./fxos-repl.py connect gallery or (env) $ ./fxos-repl.py connect app://gallery.gaiamobile.org/index.html
Connected to app://gallery.gaiamobile.org/index.html
>>> navigator.userAgent
Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0
Expand Down
7 changes: 5 additions & 2 deletions fxos-repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ def connect_to_iframe(m, name):
iframes = m.execute_script("return document.getElementsByTagName('iframe')")
for idx in range(0,iframes['length']):
iframe = iframes[str(idx)]
if iframe.get_attribute('src') == name:
if name in iframe.get_attribute('src'):
m.switch_to_frame(iframe)
return True
return False

def start_repl(m):
try:
while True:
s = raw_input(">>> ")
if s is None:
if s == "" or s == "exit" or s == "quit":
break
try:
print m.execute_script("return " + s, new_sandbox=False)
Expand Down Expand Up @@ -54,6 +55,8 @@ def start_repl(m):
if connect_to_iframe(m, sys.argv[2]):
print "Connected to " + sys.argv[2]
start_repl(m)
else:
print "Wrong iframe to connect!"
else:
usage()
sys.exit(1)
Expand Down