author Shawn Wilsher <sdwilsh@shawnwilsher.com>
Fri, 31 Oct 2008 20:38:58 -0400
changeset 21163 78b60e831d3c69108a8daa8d1145059e9830fd3e
parent 1 9b2a99adc05e53cd4010de512f50118594756650
permissions -rw-r--r--
Bug 461344 - abort if the version of sqlite we are using is not new enough This adds a runtime check to ensure that the version of SQLite that is running is the same as the one that we were compiled with. If the check fails, we will display a prompt to the user, and abort. r=bsmedberg

<?xml version="1.0"?>

<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>

<dialog id="jssh_configure" title="Configure JSSh"
        ondialogaccept="return doOK();"
        ondialogcancel="return doCancel();">
    var enablectrl;
    var portctrl;
    var scriptctrl;

    function init() {
      enablectrl = document.getElementById("enable");      
      portctrl = document.getElementById("port");
      loopbackctrl = document.getElementById("loopback");
      scriptctrl = document.getElementById("script");      

      if (!opener.jssh_server)
        opener.jssh_server = { server: Components.classes["@mozilla.org/jssh-server;1"]
                               port: 9997, 
                               useLoopbackOnly: true, 
                               script: "chrome://jssh/content/jssh-debug.js" };

      // the server might have been started from elsewhere, in which
      // case we need to get the port, etc. parameters directly from the server:
      if (opener.jssh_server.server.serverListening) {
        opener.jssh_server.port   = opener.jssh_server.server.serverPort;
        opener.jssh_server.script = opener.jssh_server.server.serverStartupURI;
        opener.jssh_server.useLoopbackOnly = opener.jssh_server.server.serverLoopbackOnly;

      enablectrl.checked = (opener.jssh_server.server.serverListening);
      portctrl.value = opener.jssh_server.port;
      loopbackctrl.checked = opener.jssh_server.useLoopbackOnly;
      scriptctrl.value = opener.jssh_server.script;

    function doOK() {
      // stop current server instance:
      if (opener.jssh_server.server.serverListening) {
      // take new values from ui:
      opener.jssh_server.port = portctrl.value;
      opener.jssh_server.useLoopbackOnly = loopbackctrl.checked;
      opener.jssh_server.script = scriptctrl.value;

      // start new server instance if requested:
      if (enablectrl.checked) {
        try {
          opener.jssh_server.server.startServerSocket(opener.jssh_server.port, opener.jssh_server.script, 
          alert("The JSSh server is now running on port "+opener.jssh_server.port+".");
          alert("The JSSh server could not be started at the given port");
          return false;
      return true;

    function doCancel() {
      return true;

  <description value="JSSh - JavaScript TCP/IP shell server"/>
  <description maxwidth="300px">
Warning: If your computer is connected to the internet and you haven't
got a properly configured firewall, enabling JSSh on other interfaces
besides the loopback interface means that *ANYONE* can connect to your
machine and execute potentially harmful code!
  <checkbox id="enable" label="Listen for connections"/>
      <column flex="1"/>
        <label control="port" value="Port to listen on:"/>
        <textbox id="port" size="5"/>
        <label control="script" value="Startup script:"/>
        <textbox id="script" />
  <checkbox id="loopback" label="Restrict to local loopback interface ("/>