Remove javascript support and tests from the playground.

Change-Id: I9b0e808c3fb23a8226ac9648984cfffc81873e12
diff --git a/client/public/go_js/index.html b/client/public/go_js/index.html
deleted file mode 100644
index ea4b8d5..0000000
--- a/client/public/go_js/index.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Playground</title>
-    <link rel="stylesheet" href="/bundle.css">
-    <script src="/bundle.js" async></script>
-  </head>
-  <body>
-    <main>
-      <h1>Hello, go-js playground!</h1>
-      <div class="lang-go lang-js playground" data-src="/fortune/bundle_go_js.json"></div>
-    </main>
-  </body>
-</html>
diff --git a/client/public/js/index.html b/client/public/js/index.html
deleted file mode 100644
index 3a789bb..0000000
--- a/client/public/js/index.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Playground</title>
-    <link rel="stylesheet" href="/bundle.css">
-    <script src="/bundle.js" async></script>
-  </head>
-  <body>
-    <main>
-      <h1>Hello, js playground!</h1>
-      <!-- lang-go needed for vdl -->
-      <div class="lang-js lang-go playground" data-src="/fortune/bundle_js.json"></div>
-    </main>
-  </body>
-</html>
diff --git a/client/public/js_go/index.html b/client/public/js_go/index.html
deleted file mode 100644
index d43c009..0000000
--- a/client/public/js_go/index.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Playground</title>
-    <link rel="stylesheet" href="/bundle.css">
-    <script src="/bundle.js" async></script>
-  </head>
-  <body>
-    <main>
-      <h1>Hello, js-go playground!</h1>
-      <div class="lang-js lang-go playground" data-src="/fortune/bundle_js_go.json"></div>
-    </main>
-  </body>
-</html>
diff --git a/go/src/v.io/x/playground/.gitignore b/go/src/v.io/x/playground/.gitignore
index f11c1aa..3bb5a6d 100644
--- a/go/src/v.io/x/playground/.gitignore
+++ b/go/src/v.io/x/playground/.gitignore
@@ -1,4 +1,3 @@
-node_modules
 config/*.json
 !config/db-*-example.json
 !config/db-*-default.json
diff --git a/go/src/v.io/x/playground/Dockerfile b/go/src/v.io/x/playground/Dockerfile
index bf99bc4..7ae6680 100644
--- a/go/src/v.io/x/playground/Dockerfile
+++ b/go/src/v.io/x/playground/Dockerfile
@@ -3,7 +3,7 @@
 
 # Install various prereqs.
 RUN apt-get update && \
-    apt-get install -y curl git nodejs nodejs-legacy npm && \
+    apt-get install -y curl git && \
     apt-get clean
 
 # Install Go. Note, the apt-get "golang" target is too old.
@@ -37,7 +37,6 @@
 RUN npm install --production $JIRI_ROOT/release/javascript/core
 
 # Install Vanadium libraries and playground binaries.
-RUN jiri go install -a -tags wspr -v v.io/x/ref/services/wspr/...
 RUN jiri go install -v v.io/...
 
 # Uncomment the following lines to install a version of the builder tool using
diff --git a/go/src/v.io/x/playground/Makefile b/go/src/v.io/x/playground/Makefile
index a943a7e..3a7ceb3 100644
--- a/go/src/v.io/x/playground/Makefile
+++ b/go/src/v.io/x/playground/Makefile
@@ -14,7 +14,6 @@
 # builder-deps target builds the binaries that the builder calls.
 .PHONY: builder-deps
 builder-deps:
-	jiri go install -a -tags wspr v.io/x/ref/services/wspr/wsprd
 	jiri go install v.io/x/ref/cmd/principal
 	jiri go install v.io/x/ref/services/identity/identityd
 	jiri go install v.io/x/ref/services/mounttable/mounttabled
diff --git a/go/src/v.io/x/playground/README.md b/go/src/v.io/x/playground/README.md
index 87a0329..2c69624 100644
--- a/go/src/v.io/x/playground/README.md
+++ b/go/src/v.io/x/playground/README.md
@@ -34,7 +34,7 @@
 
 Test your image (without running compilerd):
 
-    $ $JIRI_ROOT/release/projects/playground/go/bin/pgadmin bundle make fortune js-go | docker run -i playground
+    $ $JIRI_ROOT/release/projects/playground/go/bin/pgadmin bundle make fortune go | docker run -i playground
 
 
 ## Running the playground server (compilerd)
diff --git a/go/src/v.io/x/playground/builder/builder_v23_test.go b/go/src/v.io/x/playground/builder/builder_v23_test.go
index 2351ee6..4837f7a 100644
--- a/go/src/v.io/x/playground/builder/builder_v23_test.go
+++ b/go/src/v.io/x/playground/builder/builder_v23_test.go
@@ -8,7 +8,6 @@
 	"bytes"
 	"os"
 	"path/filepath"
-	"strings"
 	"testing"
 
 	"v.io/x/playground/lib/bundle/bundler"
@@ -18,7 +17,7 @@
 )
 
 var (
-	vanadiumRoot, nodejsBinRoot, playgroundRoot string
+	vanadiumRoot, playgroundRoot string
 )
 
 func initTest(t *testing.T, sh *v23test.Shell) (builderPath string) {
@@ -27,11 +26,6 @@
 		t.Fatal("JIRI_ROOT must be set")
 	}
 
-	out := sh.Cmd("jiri", "v23-profile", "list", "--info=Target.InstallationDir", "nodejs").Stdout()
-
-	nodejsBinRoot = filepath.Join(strings.TrimSpace(out), "bin")
-
-	v23test.BuildGoPkg(sh, "v.io/x/ref/services/wspr/wsprd", "-a", "-tags", "wspr")
 	v23test.BuildGoPkg(sh, "v.io/x/ref/cmd/principal")
 	v23test.BuildGoPkg(sh, "v.io/x/ref/cmd/vdl")
 	v23test.BuildGoPkg(sh, "v.io/x/ref/services/mounttable/mounttabled")
@@ -39,16 +33,9 @@
 
 	playgroundRoot = filepath.Join(vanadiumRoot, "release", "projects", "playground")
 
-	npmInstall(sh, filepath.Join(vanadiumRoot, "release/javascript/core"))
-
 	return v23test.BuildGoPkg(sh, "v.io/x/playground/builder")
 }
 
-func npmInstall(sh *v23test.Shell, dir string) {
-	npmBinPath := filepath.Join(nodejsBinRoot, "npm")
-	sh.Cmd(npmBinPath, "install", "--production", dir).Run()
-}
-
 // Bundles a playground example and tests it using builder.
 // - dir is the root directory of example to test
 // - globList is the list of glob patterns specifying files to use from dir
@@ -60,19 +47,10 @@
 	}
 
 	tmp := sh.MakeTempDir()
-	// TODO(ivanpi): Make sh.Pushd return old wd?
-	cwd, err := os.Getwd()
-	if err != nil {
-		t.Fatal(tu.FormatLogLine(1, "getwd: failed: %v", err))
-	}
 	sh.Pushd(tmp)
 	defer sh.Popd()
-	old := filepath.Join(cwd, "node_modules")
-	if err := os.Symlink(old, filepath.Join(".", filepath.Base(old))); err != nil {
-		t.Fatal(tu.FormatLogLine(1, "symlink: failed: %v", err))
-	}
 
-	PATH := os.Getenv("V23_BIN_DIR") + ":" + nodejsBinRoot
+	PATH := os.Getenv("V23_BIN_DIR")
 	if path := os.Getenv("PATH"); len(path) > 0 {
 		PATH += ":" + path
 	}
@@ -99,12 +77,6 @@
 	}{
 		{"basic ping (go -> go)",
 			[]string{"src/pong/pong.go", "src/ping/ping.go", "src/pingpong/wire.vdl"}},
-		{"basic ping (js -> js)",
-			[]string{"src/pong/pong.js", "src/ping/ping.js", "src/pingpong/wire.vdl"}},
-		{"basic ping (js -> go)",
-			[]string{"src/pong/pong.go", "src/ping/ping.js", "src/pingpong/wire.vdl"}},
-		{"basic ping (go -> js)",
-			[]string{"src/pong/pong.js", "src/ping/ping.go", "src/pingpong/wire.vdl"}},
 	}
 
 	testdataDir := filepath.Join(playgroundRoot, "go", "src", "v.io", "x", "playground", "testdata")
diff --git a/go/src/v.io/x/playground/builder/main.go b/go/src/v.io/x/playground/builder/main.go
index 27acee0..b562790 100644
--- a/go/src/v.io/x/playground/builder/main.go
+++ b/go/src/v.io/x/playground/builder/main.go
@@ -30,7 +30,6 @@
 	"os/exec"
 	"path"
 	"path/filepath"
-	"strconv"
 	"strings"
 	"sync"
 	"syscall"
@@ -43,9 +42,9 @@
 
 var (
 	verbose              = flag.Bool("verbose", true, "Whether to output debug messages.")
-	includeServiceOutput = flag.Bool("includeServiceOutput", false, "Whether to stream service (mounttable, wspr, proxy) output to clients.")
+	includeServiceOutput = flag.Bool("includeServiceOutput", false, "Whether to stream service (mounttable, proxy) output to clients.")
 	includeProfileEnv    = flag.Bool("includeProfileEnv", false, "Whether to log the output of \"jiri profile env\" before compilation.")
-	// TODO(ivanpi): Separate out mounttable, proxy, wspr timeouts. Add compile timeout. Revise default.
+	// TODO(ivanpi): Separate out mounttable and proxy timeouts. Add compile timeout. Revise default.
 	runTimeout = flag.Duration("runTimeout", 5*time.Second, "Time limit for running user code.")
 
 	stopped = false    // Whether we have stopped execution of running files.
@@ -79,7 +78,7 @@
 	binaryName string
 	// Running cmd process for the file.
 	cmd *exec.Cmd
-	// Any subprocesses that are needed to support running the file (e.g. wspr).
+	// Any subprocesses that are needed to support running the file (e.g. mounttable).
 	subprocs []*os.Process
 	// The index of the file in the request.
 	index int
@@ -142,10 +141,6 @@
 			i--
 		} else {
 			switch path.Ext(f.Name) {
-			case ".js":
-				// JavaScript files are always executable.
-				f.executable = true
-				f.lang = "js"
 			case ".go":
 				// Go files will be marked as executable if their package name is
 				// "main". This happens in the "maybeSetExecutableAndBinaryName"
@@ -224,16 +219,6 @@
 	// TODO(ivanpi): We assume *exec.ExitError results from uncompilable input
 	// files; other cases can result from bugs in playground backend or compiler
 	// itself.
-	if found["js"] && found["vdl"] {
-		debug("Generating VDL for Javascript")
-		err = makeCmd("<compile>", false, "",
-			"vdl", "generate", "-lang=Javascript", "-js-out-dir="+srcd, "./...").Run()
-		if _, ok := err.(*exec.ExitError); ok {
-			return true, nil
-		} else if err != nil {
-			return false, err
-		}
-	}
 	if found["go"] {
 		debug("Generating VDL for Go and compiling Go")
 		err = makeCmd("<compile>", false, "",
@@ -321,17 +306,6 @@
 	return ioutil.WriteFile(f.Name, []byte(f.Body), 0644)
 }
 
-func (f *codeFile) startJs() error {
-	wsprProc, wsprPort, err := startWspr(f.Name, f.credentials, *runTimeout)
-	if err != nil {
-		return fmt.Errorf("Error starting wspr: %v", err)
-	}
-	f.subprocs = append(f.subprocs, wsprProc)
-	os.Setenv("WSPR", "http://localhost:"+strconv.Itoa(wsprPort))
-	f.cmd = makeCmd(f.Name, false, "", "node", f.Name)
-	return f.cmd.Start()
-}
-
 func (f *codeFile) startGo() error {
 	f.cmd = makeCmd(f.Name, false, f.credentials, filepath.Join("bin", f.binaryName))
 	return f.cmd.Start()
@@ -349,8 +323,6 @@
 		switch f.lang {
 		case "go":
 			return f.startGo()
-		case "js":
-			return f.startJs()
 		default:
 			return fmt.Errorf("Cannot run file %q", f.Name)
 		}
diff --git a/go/src/v.io/x/playground/builder/services.go b/go/src/v.io/x/playground/builder/services.go
index b8be6a5..5b7ea70 100644
--- a/go/src/v.io/x/playground/builder/services.go
+++ b/go/src/v.io/x/playground/builder/services.go
@@ -15,7 +15,6 @@
 	"os"
 	"os/exec"
 	"regexp"
-	"strconv"
 	"time"
 
 	"v.io/x/playground/lib"
@@ -64,28 +63,6 @@
 	return cmd.Process, nil
 }
 
-// startWspr starts a wsprd process. We run one wsprd process for each
-// javascript file being run.
-func startWspr(fileName, credentials string, timeLimit time.Duration) (proc *os.Process, port int, err error) {
-	cmd := makeCmd("<wsprd>:"+fileName, true, credentials,
-		"wsprd",
-		"-v23.proxy="+proxyName,
-		"-v23.tcp.address=127.0.0.1:0",
-		"-port=0",
-		// The identd server won't be used, so pass a fake name.
-		"-identd=/unused")
-	parts, err := startAndWaitFor(cmd, timeLimit, regexp.MustCompile(".*port: (.*)"))
-	if err != nil {
-		return nil, 0, fmt.Errorf("Error starting wspr: %v", err)
-	}
-	portstr := parts[1]
-	port, err = strconv.Atoi(portstr)
-	if err != nil {
-		return nil, 0, fmt.Errorf("Malformed port: %q: %v", portstr, err)
-	}
-	return cmd.Process, port, nil
-}
-
 // Helper function to start a command and wait for output.  Arguments are a cmd
 // to run, a timeout, and a regexp.  The slice of strings matched by the regexp
 // is returned.
diff --git a/go/src/v.io/x/playground/bundles/config.json b/go/src/v.io/x/playground/bundles/config.json
index e5e6cbb..503b996 100644
--- a/go/src/v.io/x/playground/bundles/config.json
+++ b/go/src/v.io/x/playground/bundles/config.json
@@ -4,10 +4,7 @@
       "name": "fortune",
       "path": "fortune",
       "globs": [
-        "go",
-        "js",
-        "js-go",
-        "go-js"
+        "go"
       ],
       "output": [
         "server.*Serving:",
@@ -23,27 +20,6 @@
         "client/**/*.go",
         "server/**/*.go"
       ]
-    },
-    "js": {
-      "patterns": [
-        "*.vdl",
-        "client/**/*.js",
-        "server/**/*.js"
-      ]
-    },
-    "js-go": {
-      "patterns": [
-        "*.vdl",
-        "client/**/*.js",
-        "server/**/*.go"
-      ]
-    },
-    "go-js": {
-      "patterns": [
-        "*.vdl",
-        "client/**/*.go",
-        "server/**/*.js"
-      ]
     }
   }
 }
diff --git a/go/src/v.io/x/playground/bundles/fortune/src/client/client.js b/go/src/v.io/x/playground/bundles/fortune/src/client/client.js
deleted file mode 100644
index c13afd6..0000000
--- a/go/src/v.io/x/playground/bundles/fortune/src/client/client.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// pg-index=2
-
-var vanadium = require('vanadium');
-
-/**
- * Create a Vanadium runtime using the configuration defined in config.js,
- * and bind it to the bakery/cookie/fortune service.
- */
-vanadium.init(function(err, rt) {
-  if (err) { return error(err); }
-
-  var ctx = rt.getContext();
-  var client = rt.getClient();
-
-  console.info('Binding to service');
-  retryBindTo(ctx, client, function(err, fortuneService) {
-    if (err) { return error(err); }
-
-    console.info('Issuing request');
-    fortuneService.getRandomFortune(ctx, function(err, fortune) {
-      if (err) { return error(err); }
-
-      console.log('Received: ' + fortune);
-      process.exit(0);
-    });
-  });
-});
-
-function retryBindTo(ctx, client, cb) {
-  var timeoutCtx = ctx.withTimeout(500);
-  client.bindTo(timeoutCtx, 'bakery/cookie/fortune', function(err, fortuneService) {
-    if (err) {
-      console.error(err + '\nRetrying in 100ms...');
-      return setTimeout(function() {
-        retryBindTo(ctx, client, cb);
-      }, 100);
-    }
-
-    cb(null, fortuneService);
-  });
-}
-
-function error(err) {
-  console.error(err);
-  process.exit(1);
-}
diff --git a/go/src/v.io/x/playground/bundles/fortune/src/server/server.js b/go/src/v.io/x/playground/bundles/fortune/src/server/server.js
deleted file mode 100644
index 6aca4e6..0000000
--- a/go/src/v.io/x/playground/bundles/fortune/src/server/server.js
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// pg-index=1
-
-var inherits = require('util').inherits;
-var vanadium = require('vanadium');
-
-var fortune = require('../fortune');
-
-/**
- * 1) Implement a simple fortune service
- */
-
-function FortuneService() {
-  // List of fortunes
-  this.fortunes = [];
-}
-
-inherits(FortuneService, fortune.Fortune);
-
-// Gets a random fortune
-FortuneService.prototype.getRandomFortune = function(ctx, serverCall) {
-  var numExistingfortunes = this.fortunes.length;
-  if(numExistingfortunes === 0) {
-    throw new Error('Sorry! No fortune available :(');
-  }
-  var randomIndex = Math.floor(Math.random() * numExistingfortunes);
-  var fortune = this.fortunes[randomIndex];
-  console.info('Serving:', fortune);
-  return Promise.resolve(fortune);
-};
-
-// Adds a new fortune
-FortuneService.prototype.addNewFortune = function(ctx, serverCall, fortune) {
-  if(!fortune || fortune.trim() === '') {
-    throw new Error('Sorry! Can\'t add empty or null fortune!');
-  }
-  console.info('Adding:', fortune);
-  this.fortunes.push(fortune);
-  return Promise.resolve();
-};
-
-/**
- * 2) Publish the fortune service
- */
-
-var fortuneService = new FortuneService();
-
-// Create a Vanadium runtime using the configuration
-vanadium.init().then(function(rt) {
-  // Serve the fortune server under a name. Serve returns a Promise object
-  rt.newServer('bakery/cookie/fortune', fortuneService).then(function() {
-    console.log('Fortune server serving under: bakery/cookie/fortune');
-  }).catch(function(err) {
-    console.error('Failed to serve the fortune server because:\n', err);
-    process.exit(1);
-  });
-}).catch(function(err) {
-  console.error('Failed to start the fortune server because:\n', err);
-  process.exit(1);
-});
-
-// Let's add a few fortunes to start with
-[
-  'The fortune you seek is in another cookie.',
-  'Everything will now come your way.',
-  'Conquer your fears or they will conquer you.'
-].forEach(function(fortune) {
-  fortuneService.addNewFortune(null, null, fortune);
-});
diff --git a/go/src/v.io/x/playground/testdata/src/ping/ping.js b/go/src/v.io/x/playground/testdata/src/ping/ping.js
deleted file mode 100644
index 99e8a03..0000000
--- a/go/src/v.io/x/playground/testdata/src/ping/ping.js
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-var vanadium = require('vanadium');
-
-vanadium.init(function(err, rt) {
-  if (err) throw err;
-
-  var ctx = rt.getContext();
-
-  console.log('Binding to service');
-  rt.getClient().bindTo(ctx, 'pingpong', function(err, s) {
-    if (err) throw err;
-
-    console.log('Pinging');
-    s.ping(ctx, 'PING', function(err, pong) {
-      if (err) throw err;
-
-      console.log(pong);
-      process.exit(0);
-    });
-  });
-});
diff --git a/go/src/v.io/x/playground/testdata/src/pong/pong.js b/go/src/v.io/x/playground/testdata/src/pong/pong.js
deleted file mode 100644
index 2ae1a2f..0000000
--- a/go/src/v.io/x/playground/testdata/src/pong/pong.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-var inherits = require('util').inherits;
-var vanadium = require('vanadium');
-
-var pingpong = require('../pingpong');
-
-function PingPongService() {}
-
-inherits(PingPongService, pingpong.PingPong);
-
-PingPongService.prototype.ping = function(ctx, serverCall, message) {
-  var secCall = serverCall.securityCall;
-  console.log('[' + secCall.remoteBlessingStrings + '] ' + message);
-  return Promise.resolve('PONG');
-};
-
-var pingPongService = new PingPongService();
-
-vanadium.init(function(err, rt) {
-  if (err) throw err;
-
-  console.log('Starting server');
-  rt.newServer('pingpong', pingPongService, function(err) {
-    if (err) throw err;
-
-    console.log('Serving pingpong');
-  });
-});