src/java.desktop/share/classes/sun/applet/AppletSecurity.java
changeset 49520 7a64b48586d8
parent 48027 ddbcfca4d51d
equal deleted inserted replaced
49519:94129cb29710 49520:7a64b48586d8
     1 /*
     1 /*
     2  * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   369             }
   369             }
   370         }
   370         }
   371     }
   371     }
   372 
   372 
   373     /**
   373     /**
   374      * Tests if a client can get access to the AWT event queue.
       
   375      * <p>
       
   376      * This method calls {@code checkPermission} with the
       
   377      * {@code AWTPermission("accessEventQueue")} permission.
       
   378      *
       
   379      * @since   1.1
       
   380      * @exception  SecurityException  if the caller does not have
       
   381      *             permission to access the AWT event queue.
       
   382      */
       
   383     @SuppressWarnings({"deprecation",
       
   384                        "removal"}) //  SecurityManager.checkAwtEventQueueAccess
       
   385     public void checkAwtEventQueueAccess() {
       
   386         AppContext appContext = AppContext.getAppContext();
       
   387         AppletClassLoader appletClassLoader = currentAppletClassLoader();
       
   388 
       
   389         if (AppContext.isMainContext(appContext) && (appletClassLoader != null)) {
       
   390             // If we're about to allow access to the main EventQueue,
       
   391             // and anything untrusted is on the class context stack,
       
   392             // disallow access.
       
   393             super.checkPermission(AWTPermissions.CHECK_AWT_EVENTQUEUE_PERMISSION);
       
   394         }
       
   395     } // checkAwtEventQueueAccess()
       
   396 
       
   397     /**
       
   398      * Returns the thread group of the applet. We consult the classloader
   374      * Returns the thread group of the applet. We consult the classloader
   399      * if there is one.
   375      * if there is one.
   400      */
   376      */
   401     public ThreadGroup getThreadGroup() {
   377     public ThreadGroup getThreadGroup() {
   402         /* If any applet code is on the execution stack, we return
   378         /* If any applet code is on the execution stack, we return