SLING-5022 - ImporterTopLevel is not set up correctly for the RhinoJavaScriptEngine
* made sure the ImporterTopLevel is initialised with the global context
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1702951 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java b/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java
index 158ff22..d1d83ca 100644
--- a/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java
+++ b/src/main/java/org/apache/sling/scripting/javascript/internal/RhinoJavaScriptEngine.java
@@ -248,7 +248,7 @@
} else {
// create the request top scope, use the ImporterToplevel here
// to support the importPackage and importClasses functions
- scope = new ImporterTopLevel();
+ scope = new ImporterTopLevel(rhinoContext);
// Set the global scope to be our prototype
scope.setPrototype(rootScope);
diff --git a/src/test/java/org/apache/sling/scripting/javascript/wrapper/ScriptableNodeTest.java b/src/test/java/org/apache/sling/scripting/javascript/wrapper/ScriptableNodeTest.java
index ff1df99..b664c22 100644
--- a/src/test/java/org/apache/sling/scripting/javascript/wrapper/ScriptableNodeTest.java
+++ b/src/test/java/org/apache/sling/scripting/javascript/wrapper/ScriptableNodeTest.java
@@ -332,11 +332,6 @@
String code = "node['singleRef']";
assertTrue(script.eval(code, data) instanceof Node);
- code = "node.singleRef instanceof Array";
- assertEquals(false, script.eval(code, data));
-
- code = "node.multiRef instanceof Array";
- assertEquals(true, script.eval(code, data));
code = "node.multiRef[0]";
assertTrue(script.eval(code, data) instanceof Node);