Merge

Wed, 27 Aug 2014 14:34:22 +0200

author
attila
date
Wed, 27 Aug 2014 14:34:22 +0200
changeset 981
d93eabe28080
parent 980
44b69fb3b031
parent 974
c9866d77c14c
child 982
e56d1f4ecd91
child 983
8c282c15c58c

Merge

     1.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java	Tue Aug 26 15:52:55 2014 +0200
     1.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java	Wed Aug 27 14:34:22 2014 +0200
     1.3 @@ -271,6 +271,11 @@
     1.4  
     1.5      @Test
     1.6      public static void proxyStaticAccessCheckTest() throws ScriptException {
     1.7 +        if (System.getSecurityManager() == null) {
     1.8 +            // pass vacuously
     1.9 +            return;
    1.10 +        }
    1.11 +
    1.12          final ScriptEngineManager m = new ScriptEngineManager();
    1.13          final ScriptEngine e = m.getEngineByName("nashorn");
    1.14          final Runnable r = (Runnable)Proxy.newProxyInstance(
    1.15 @@ -297,4 +302,43 @@
    1.16              }
    1.17          }
    1.18      }
    1.19 +
    1.20 +
    1.21 +    @Test
    1.22 +    public void nashornConfigSecurityTest() {
    1.23 +        if (System.getSecurityManager() == null) {
    1.24 +            // pass vacuously
    1.25 +            return;
    1.26 +        }
    1.27 +
    1.28 +        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
    1.29 +        try {
    1.30 +            fac.getScriptEngine(new ClassFilter() {
    1.31 +               @Override
    1.32 +               public boolean exposeToScripts(final String name) {
    1.33 +                   return true;
    1.34 +               }
    1.35 +            });
    1.36 +            fail("SecurityException should have been thrown");
    1.37 +        } catch (final SecurityException exp) {}
    1.38 +    }
    1.39 +
    1.40 +    @Test
    1.41 +    public void nashornConfigSecurityTest2() {
    1.42 +        if (System.getSecurityManager() == null) {
    1.43 +            // pass vacuously
    1.44 +            return;
    1.45 +        }
    1.46 +
    1.47 +        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
    1.48 +        try {
    1.49 +            fac.getScriptEngine(new String[0], null, new ClassFilter() {
    1.50 +               @Override
    1.51 +               public boolean exposeToScripts(final String name) {
    1.52 +                   return true;
    1.53 +               }
    1.54 +            });
    1.55 +            fail("SecurityException should have been thrown");
    1.56 +        } catch (final SecurityException exp) {}
    1.57 +    }
    1.58  }
     2.1 --- a/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Tue Aug 26 15:52:55 2014 +0200
     2.2 +++ b/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Wed Aug 27 14:34:22 2014 +0200
     2.3 @@ -629,34 +629,6 @@
     2.4          assertEquals(enumerable, Boolean.FALSE);
     2.5      }
     2.6  
     2.7 -    @Test
     2.8 -    public void nashornConfigSecurityTest() {
     2.9 -        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
    2.10 -        try {
    2.11 -            fac.getScriptEngine(new ClassFilter() {
    2.12 -               @Override
    2.13 -               public boolean exposeToScripts(final String name) {
    2.14 -                   return true;
    2.15 -               }
    2.16 -            });
    2.17 -            fail("SecurityException should have been thrown");
    2.18 -        } catch (final SecurityException exp) {}
    2.19 -    }
    2.20 -
    2.21 -    @Test
    2.22 -    public void nashornConfigSecurityTest2() {
    2.23 -        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
    2.24 -        try {
    2.25 -            fac.getScriptEngine(new String[0], null, new ClassFilter() {
    2.26 -               @Override
    2.27 -               public boolean exposeToScripts(final String name) {
    2.28 -                   return true;
    2.29 -               }
    2.30 -            });
    2.31 -            fail("SecurityException should have been thrown");
    2.32 -        } catch (final SecurityException exp) {}
    2.33 -    }
    2.34 -
    2.35      private static void checkProperty(final ScriptEngine e, final String name)
    2.36          throws ScriptException {
    2.37          final String value = System.getProperty(name);

mercurial