test/script/sandbox/classloader.js

changeset 717
eca774d33fa4
parent 7
5a1b0714df0e
child 952
6d5471a497fb
child 962
ac62e33a99b0
     1.1 --- a/test/script/sandbox/classloader.js	Thu Jan 30 18:34:37 2014 +0530
     1.2 +++ b/test/script/sandbox/classloader.js	Thu Jan 30 19:04:00 2014 +0530
     1.3 @@ -26,6 +26,7 @@
     1.4   *
     1.5   * @test
     1.6   * @security
     1.7 + * @bug JDK-8032954: Nashorn: extend Java.extend
     1.8   */
     1.9  
    1.10  try {
    1.11 @@ -39,3 +40,24 @@
    1.12      }
    1.13  }
    1.14  
    1.15 +try {
    1.16 +    Java.extend(Java.type('java.lang.ClassLoader'));
    1.17 +    fail("should have thrown SecurityException");
    1.18 +} catch (e) {
    1.19 +    if (e instanceof java.lang.SecurityException) {
    1.20 +        print(e);
    1.21 +    } else {
    1.22 +        fail("expected SecurityException, got " + e);
    1.23 +    }
    1.24 +}
    1.25 +
    1.26 +try {
    1.27 +    Java.extend(Java.type("javax.management.loading.MLet"));
    1.28 +    fail("should have thrown SecurityException");
    1.29 +} catch (e) {
    1.30 +    if (e instanceof java.lang.SecurityException) {
    1.31 +        print(e);
    1.32 +    } else {
    1.33 +        fail("expected SecurityException, got " + e);
    1.34 +    }
    1.35 +}

mercurial