From 1c0320b36d23351b689658e462ad7274ef72a6af Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 4 Apr 2021 12:22:15 -0700 Subject: [PATCH] Use Graal JavaScript VM. Nashorn was removed in JDK15, but the PAC proxy detection code depends on having a JavaScript VM (what a twisty maze of passages). Rather than remove it completely, I'll just keep the tests working so that people who use Getdown with PAC proxies on JDK 14 or earlier can keep on trucking. Perhaps the JavaScript code could be rewritten in Java and this weird massive dependency could be eliminated? --- launcher/pom.xml | 12 ++++++++++++ .../threerings/getdown/launcher/ProxyUtilTest.java | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/launcher/pom.xml b/launcher/pom.xml index 9b62870..1a84670 100644 --- a/launcher/pom.xml +++ b/launcher/pom.xml @@ -44,6 +44,18 @@ 4.13.1 test + + org.graalvm.js + js + 20.3.0 + test + + + org.graalvm.js + js-scriptengine + 20.3.0 + test + diff --git a/launcher/src/test/java/com/threerings/getdown/launcher/ProxyUtilTest.java b/launcher/src/test/java/com/threerings/getdown/launcher/ProxyUtilTest.java index 43ee670..e21377b 100644 --- a/launcher/src/test/java/com/threerings/getdown/launcher/ProxyUtilTest.java +++ b/launcher/src/test/java/com/threerings/getdown/launcher/ProxyUtilTest.java @@ -25,6 +25,10 @@ public class ProxyUtilTest { } @Test public void testPACProxy () throws Exception { + // we use the Graal JavaScrip VM for testing, because JDK15 no longer bundles Nashorn, but + // it does not support calling back into Java unless we set this compatibility property + System.setProperty("polyglot.js.nashorn-compat", "true"); + String EXAMPLE0 = "function FindProxyForURL(url, host) {\n" + " if (shExpMatch(host, '*.example.com')) { return 'DIRECT'; }\n" +