Skip to content
This repository has been archived by the owner on Aug 19, 2021. It is now read-only.

Commit

Permalink
Respect "allow outside connections" preference.
Browse files Browse the repository at this point in the history
  • Loading branch information
bard committed Dec 14, 2011
1 parent 646208b commit 86bf1fa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
5 changes: 2 additions & 3 deletions chrome/content/overlay_impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@ function togglePref(prefName) {
}

function toggleServer(sourceCommand) {
var port = pref.getIntPref('port');

if(server.isActive())
server.stop();
else
server.start(port);
server.start(pref.getIntPref('port'),
pref.getBoolPref('loopbackOnly'));
}

function updateMenu(xulPopup) {
Expand Down
3 changes: 2 additions & 1 deletion chrome/content/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ function observe(subject, topic, data) {
srvObserver.addObserver(this, 'network:offline-status-changed', false);
if(srvPref.getBranch('network.').getBoolPref('online') &&
pref.getBoolPref('autoStart'))
this.start(pref.getIntPref('port'));
this.start(pref.getIntPref('port'),
pref.getBoolPref('loopbackOnly'));

break;
case 'network:offline-status-changed':
Expand Down
10 changes: 6 additions & 4 deletions chrome/content/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,20 @@ function constructor(server) {
}

function toggleServer(sourceCommand) {
var port = Components
var pref = Components
.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefService)
.getBranch('extensions.mozrepl.')
.getIntPref('port');
.getBranch('extensions.mozrepl.');

var port = pref.getIntPref('port');
var loopbackOnly = pref.getBoolPref('loopbackOnly');

if(this._server.isActive()) {
this._server.stop();
sourceCommand.setAttribute('label', 'Start Repl');
}
else {
this._server.start(port);
this._server.start(port, loopbackOnly);
sourceCommand.setAttribute('label', 'Stop Repl');
}
}
Expand Down
3 changes: 2 additions & 1 deletion components/CommandLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ MozReplCommandLineHandler.prototype = {
if(start || contextWindowType) {
var port = Number(cmdLine.handleFlagWithParam('repl', false)) ||
srvPref.getIntPref('port');
var loopbackOnly = srvPref.getBoolPref('loopbackOnly');

var service = Cc['@hyperstruct.net/mozlab/mozrepl;1']
.getService(Ci.nsIMozRepl)
Expand All @@ -71,7 +72,7 @@ MozReplCommandLineHandler.prototype = {
if(contextWindowType)
service.setContextWindowType(contextWindowType);

service.start(port);
service.start(port, loopbackOnly);
}
},

Expand Down

0 comments on commit 86bf1fa

Please # to comment.