Mercurial > people > rkennke > jdk9-shenandoah-final > nashorn
changeset 993:dbb723e6c54c
8056094: [nashorn] tests fail when running via jtreg
Reviewed-by: jlaskey, hannesw
author | sundar |
---|---|
date | Tue, 26 Aug 2014 22:57:24 +0530 |
parents | fa79d912da1b |
children | e56bfeff25a9 |
files | test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java |
diffstat | 2 files changed, 44 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java Tue Aug 26 15:52:55 2014 +0200 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java Tue Aug 26 22:57:24 2014 +0530 @@ -271,6 +271,11 @@ @Test public static void proxyStaticAccessCheckTest() throws ScriptException { + if (System.getSecurityManager() == null) { + // pass vacuously + return; + } + final ScriptEngineManager m = new ScriptEngineManager(); final ScriptEngine e = m.getEngineByName("nashorn"); final Runnable r = (Runnable)Proxy.newProxyInstance( @@ -297,4 +302,43 @@ } } } + + + @Test + public void nashornConfigSecurityTest() { + if (System.getSecurityManager() == null) { + // pass vacuously + return; + } + + final NashornScriptEngineFactory fac = new NashornScriptEngineFactory(); + try { + fac.getScriptEngine(new ClassFilter() { + @Override + public boolean exposeToScripts(final String name) { + return true; + } + }); + fail("SecurityException should have been thrown"); + } catch (final SecurityException exp) {} + } + + @Test + public void nashornConfigSecurityTest2() { + if (System.getSecurityManager() == null) { + // pass vacuously + return; + } + + final NashornScriptEngineFactory fac = new NashornScriptEngineFactory(); + try { + fac.getScriptEngine(new String[0], null, new ClassFilter() { + @Override + public boolean exposeToScripts(final String name) { + return true; + } + }); + fail("SecurityException should have been thrown"); + } catch (final SecurityException exp) {} + } }
--- a/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Tue Aug 26 15:52:55 2014 +0200 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java Tue Aug 26 22:57:24 2014 +0530 @@ -629,34 +629,6 @@ assertEquals(enumerable, Boolean.FALSE); } - @Test - public void nashornConfigSecurityTest() { - final NashornScriptEngineFactory fac = new NashornScriptEngineFactory(); - try { - fac.getScriptEngine(new ClassFilter() { - @Override - public boolean exposeToScripts(final String name) { - return true; - } - }); - fail("SecurityException should have been thrown"); - } catch (final SecurityException exp) {} - } - - @Test - public void nashornConfigSecurityTest2() { - final NashornScriptEngineFactory fac = new NashornScriptEngineFactory(); - try { - fac.getScriptEngine(new String[0], null, new ClassFilter() { - @Override - public boolean exposeToScripts(final String name) { - return true; - } - }); - fail("SecurityException should have been thrown"); - } catch (final SecurityException exp) {} - } - private static void checkProperty(final ScriptEngine e, final String name) throws ScriptException { final String value = System.getProperty(name);