View Javadoc

1   package delight.rhinosandox.internal;
2   
3   import java.util.HashSet;
4   import java.util.Set;
5   import org.mozilla.javascript.ClassShutter;
6   import org.mozilla.javascript.EcmaError;
7   
8   @SuppressWarnings("all")
9   public class SafeClassShutter implements ClassShutter {
10    public final Set<String> allowedClasses;
11    
12    @Override
13    public boolean visibleToScripts(final String fullClassName) {
14      boolean _startsWith = fullClassName.startsWith("adapter");
15      if (_startsWith) {
16        return true;
17      }
18      return this.allowedClasses.contains(fullClassName);
19    }
20    
21    public SafeClassShutter() {
22      HashSet<String> _hashSet = new HashSet<String>();
23      this.allowedClasses = _hashSet;
24      String _name = EcmaError.class.getName();
25      this.allowedClasses.add(_name);
26    }
27  }