Skip to content

Commit

Permalink
Remove unwanted sharing of global scope between scripts and modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelhoral committed Jul 25, 2024
1 parent f033930 commit 423ae33
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public class RhinoScript implements CompiledScript {
* Proxy class to avoid proliferation of anonymous classes.
*/
private static class IProxy implements QuitAction {
@Override
public void quit(Context cx, int exitCode) {
/* no quit :) */
}
Expand Down Expand Up @@ -224,6 +225,7 @@ private String trimPath(String name) {
return name.indexOf("/") != -1 ? name.substring(name.lastIndexOf("/") + 1) : name;
}

@Override
public Bindings prepareBindings(org.forgerock.services.context.Context context, Bindings request, Bindings... scopes) {
// TODO Fix it later
return new SimpleBindings();
Expand Down Expand Up @@ -289,7 +291,7 @@ public Object eval(final org.forgerock.services.context.Context ctx, Bindings re

// install require function per unofficial CommonJS author documentation
// https://groups.google.com/d/msg/mozilla-rhino/HCMh_lAKiI4/P1MA3sFsNKQJ
requireBuilder.createRequire(context, inner).install(inner);
requireBuilder.createRequire(context, outer).install(inner);

final Script scriptInstance = null != script ? script : engine.createScript(scriptName);
Object result = Converter.convert(scriptInstance.exec(context, inner));
Expand Down Expand Up @@ -337,6 +339,7 @@ public InnerClassLoader(ClassLoader parent) {
super(parent);
}

@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
// First check whether it's already been loaded, if so use it
Class loadedClass = Kit.classOrNull(getParent(), name);
Expand Down

0 comments on commit 423ae33

Please sign in to comment.