@Override
 public boolean checkTopLevelWindow(final Object pWindow) {
   if (finalSecurityManager == null) {
     return true;
   }
   return finalSecurityManager.checkTopLevelWindow(pWindow);
 }
Exemplo n.º 2
0
    public boolean checkTopLevelWindow(Object window) {
      // If our users temporarily accept our cert for a session,
      // then use the same session to browse to a malicious website also using our applet,
      // that website can automatically execute the applet.
      // To resolve this issue, RobotSecurityManager overrides checkTopLevelWindow
      // to check the JVM to see if there are other instances of the applet running on different
      // domains.
      // If there are, it prompts the user to confirm that they want to run the applet before
      // continuing.

      // null is not supposed to be allowed
      // so we allow it to distinguish our security manager.
      if (window == null) {
        isActive = !isActive;
        log("Active is now " + isActive);
      }
      return window == null ? true : oldsecurity.checkTopLevelWindow(window);
    }
 @Test
 public void delegateCheckTopLevelWindow() {
   Object window = new Object();
   when(originalSecurityManager.checkTopLevelWindow(window)).thenReturn(true);
   assertThat(managerWithOriginal.checkTopLevelWindow(window), is(true));
 }
 @Override
 public boolean checkTopLevelWindow(final Object window) {
   if (securityManager != null) return securityManager.checkTopLevelWindow(window);
   return super.checkTopLevelWindow(window);
 }