# HG changeset patch # User sundar # Date 1366373761 -19800 # Node ID bc251a7b5103966862daf52887b984564d9766fe # Parent d1d564f5cf82083e099ee7fea85b464fe50dbbd2 8012612: Compile failed Reviewed-by: hannesw, jlaskey, attila diff -r d1d564f5cf82 -r bc251a7b5103 src/jdk/nashorn/internal/runtime/Context.java --- a/src/jdk/nashorn/internal/runtime/Context.java Thu Apr 18 14:25:45 2013 +0200 +++ b/src/jdk/nashorn/internal/runtime/Context.java Fri Apr 19 17:46:01 2013 +0530 @@ -56,8 +56,6 @@ import jdk.nashorn.internal.parser.Parser; import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory; import jdk.nashorn.internal.runtime.options.Options; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; /** * This class manages the global state of execution. Context is immutable. @@ -114,24 +112,9 @@ * Get the current global scope * @return the current global scope */ - @CallerSensitive public static ScriptObject getGlobal() { - final SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - // skip getCallerClass and getGlobal and get to the real caller - Class caller = Reflection.getCallerClass(); - ClassLoader callerLoader = caller.getClassLoader(); - - // Allow this method only for nashorn's own classes, objects - // package classes and Java adapter classes. Rest should - // have the necessary security permission. - if (callerLoader != myLoader && - !(callerLoader instanceof StructureLoader) && - !(JavaAdapterFactory.isAdapterClass(caller))) { - sm.checkPermission(new RuntimePermission("nashorn.getGlobal")); - } - } - + // This class in a package.access protected package. + // Trusted code only can call this method. return getGlobalTrusted(); }