B2G/gecko/testing/mochitest/server.js
/** Creates and returns an HTTP server configured to serve Mochitests. */
Creates and returns an HTTP server configured to serve Mochitests.
Creates and returns an HTTP server configured to serve Mochitests .
function createMochitestServer(serverBasePath)
{
  var server = new nsHttpServer();
  server.registerDirectory("/", serverBasePath);
  server.registerPathHandler("/server/shutdown", serverShutdown);
  server.registerPathHandler("/server/debug", serverDebug);
  server.registerContentType("sjs", "sjs"); 
  server.registerContentType("jar", "application/x-jar");
  server.registerContentType("ogg", "application/ogg");
  server.registerContentType("pdf", "application/pdf");
  server.registerContentType("ogv", "video/ogg");
  server.registerContentType("oga", "audio/ogg");
  server.registerContentType("opus", "audio/ogg; codecs=opus");
  server.registerContentType("dat", "text/plain; charset=utf-8");
  server.registerContentType("frag", "text/plain"); 
  server.registerContentType("vert", "text/plain"); 
  server.setIndexHandler(defaultDirHandler);
  var serverRoot =
    {
      getFile: function getFile(path)
      {
        var file = serverBasePath.clone().QueryInterface(Ci.nsILocalFile);
        path.split("/").forEach(function(p) {
          file.appendRelativePath(p);
        });
        return file;
      },
      QueryInterface: function(aIID) { return this; }
    };
  server.setObjectState("SERVER_ROOT", serverRoot);
  processLocations(server);
  return server;
}
function createMochitestServer ( serverBasePath ) { var server = new nsHttpServer ( ) ; server . registerDirectory ( "/" , serverBasePath ) ; server . registerPathHandler ( "/server/shutdown" , serverShutdown ) ; server . registerPathHandler ( "/server/debug" , serverDebug ) ; server . registerContentType ( "sjs" , "sjs" ) ; server . registerContentType ( "jar" , "application/x-jar" ) ; server . registerContentType ( "ogg" , "application/ogg" ) ; server . registerContentType ( "pdf" , "application/pdf" ) ; server . registerContentType ( "ogv" , "video/ogg" ) ; server . registerContentType ( "oga" , "audio/ogg" ) ; server . registerContentType ( "opus" , "audio/ogg; codecs=opus" ) ; server . registerContentType ( "dat" , "text/plain; charset=utf-8" ) ; server . registerContentType ( "frag" , "text/plain" ) ; server . registerContentType ( "vert" , "text/plain" ) ; server . setIndexHandler ( defaultDirHandler ) ; var serverRoot = { getFile : function getFile ( path ) { var file = serverBasePath . clone ( ) . QueryInterface ( Ci . nsILocalFile ) ; path . split ( "/" ) . forEach ( function ( p ) { file . appendRelativePath ( p ) ; } ) ; return file ; } , QueryInterface : function ( aIID ) { return this ; } } ; server . setObjectState ( "SERVER_ROOT" , serverRoot ) ; processLocations ( server ) ; return server ; }
Creates and returns an HTTP server configured to serve Mochitests.
Creates and returns an HTTP server configured to serve Mochitests .
// .sjs == CGI-like functionality // .frag == WebGL fragment shader // .vert == WebGL vertex shader