jdk/src/share/classes/sun/applet/AppletSecurity.java
changeset 18202 e9a6d59491ab
parent 5506 202f599c92aa
child 19807 9f7860fad128
equal deleted inserted replaced
18201:f0c28a4c1ab2 18202:e9a6d59491ab
    50  * This class defines an applet security policy
    50  * This class defines an applet security policy
    51  *
    51  *
    52  */
    52  */
    53 public
    53 public
    54 class AppletSecurity extends AWTSecurityManager {
    54 class AppletSecurity extends AWTSecurityManager {
    55     private AppContext mainAppContext;
       
    56 
    55 
    57     //URLClassLoader.acc
    56     //URLClassLoader.acc
    58     private static Field facc = null;
    57     private static Field facc = null;
    59 
    58 
    60     //AccessControlContext.context;
    59     //AccessControlContext.context;
    75     /**
    74     /**
    76      * Construct and initialize.
    75      * Construct and initialize.
    77      */
    76      */
    78     public AppletSecurity() {
    77     public AppletSecurity() {
    79         reset();
    78         reset();
    80         mainAppContext = AppContext.getAppContext();
       
    81     }
    79     }
    82 
    80 
    83     // Cache to store known restricted packages
    81     // Cache to store known restricted packages
    84     private HashSet restrictedPackages = new HashSet();
    82     private HashSet restrictedPackages = new HashSet();
    85 
    83 
   310      */
   308      */
   311     public void checkAwtEventQueueAccess() {
   309     public void checkAwtEventQueueAccess() {
   312         AppContext appContext = AppContext.getAppContext();
   310         AppContext appContext = AppContext.getAppContext();
   313         AppletClassLoader appletClassLoader = currentAppletClassLoader();
   311         AppletClassLoader appletClassLoader = currentAppletClassLoader();
   314 
   312 
   315         if ((appContext == mainAppContext) && (appletClassLoader != null)) {
   313         if (AppContext.isMainContext(appContext) && (appletClassLoader != null)) {
   316             // If we're about to allow access to the main EventQueue,
   314             // If we're about to allow access to the main EventQueue,
   317             // and anything untrusted is on the class context stack,
   315             // and anything untrusted is on the class context stack,
   318             // disallow access.
   316             // disallow access.
   319             super.checkAwtEventQueueAccess();
   317             super.checkAwtEventQueueAccess();
   320         }
   318         }