Closed Bug 1043396 Opened 10 years ago Closed 8 years ago

Impossible to know which port the simulator is running on

Categories

(DevTools Graveyard :: WebIDE, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: sole, Unassigned)

References

Details

(Whiteboard: [btpp-close-now])

If I understand it correctly, the ADB helper plugin tunnels/forwards data from the phone into a local port that the WebIDE in turn connects to. The previous App Manager showed this data in the status bar if I remember correctly but now I don't know where to get this info.

I'm trying to use it for connecting to the simulator using the still-under-development sublime text plugin, so I need to find out which port is it that the simulator is listening to :-)
Depends on: enable-webide
(In reply to Soledad Penades [:sole] [:spenades] from comment #0)
> If I understand it correctly, the ADB helper plugin tunnels/forwards data
> from the phone into a local port that the WebIDE in turn connects to. The
> previous App Manager showed this data in the status bar if I remember
> correctly but now I don't know where to get this info.
> 
> I'm trying to use it for connecting to the simulator using the
> still-under-development sublime text plugin, so I need to find out which
> port is it that the simulator is listening to :-)

What about, instead, start the simulator from ST?

SIMDIR=$FIREFOXPROFILE/extensions/fxos_2_0_simulator@mozilla.org
$SIMDIR/b2g/b2g -profile $SIMDIR/profile -no-remote -dbgport 4242

Here I choose 4242, but you can use whatever you want.
$ pwd
/Users/mozilla/Library/Application Support/Firefox/Profiles/x6kiu2xm.default/extensions/fxos_2_1_simulator@mozilla.org
$ b2g/B2G.app/Contents/MacOS/b2g-bin -profile ./profile -no-remote -dbgport 4242

I get an error saying "Your B2G profile cannot be loaded. It may be missing or inaccessible."
Hmm, maybe on mac you want to use "b2g" not "b2g-bin".
I don't know why, but you have to supply a full, absolute path to the profile:

$ b2g/B2G.app/Contents/MacOS/b2g-bin -profile /Users/jryans/Library/Application\ Support/Firefox/Profiles/i9e2tppc.development/extensions/fxos_2_1_simulator@mozilla.org/profile -start-debugger-server 53108 -no-remote

Also, recent versions (2.0, 2.1) use -start-debugger-server instead of -dbgport.  See the code from the add-on[1].

[1]: http://dxr.mozilla.org/mozilla-central/source/b2g/simulator/lib/simulator-process.js#177
To solve @sole's question I just wrote a python script that finds the port of listening b2g-bin:
https://pastebin.mozilla.org/5621517
I think I made the paste expiring in one day, here is an updatable long-term one https://gist.github.com/nicolagreco/63bb6868cfcd7bab81f6
Little update on this, in order to find opened b2g listening on a port I packaged the above into a library. https://github.com/nicola/moz-discover-ports
FYI, it is now called fx-ports (https://github.com/nicola/fx-ports ) - Windows support on its way. You can now install it globally and use it as: `$ fx-ports`.
Filter on TEAPOT-SPLINES.

I believe we can consider this fixed by https://github.com/mozilla/node-firefox-find-ports and friends.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Whiteboard: [btpp-close-now]
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.