You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2003/12/31 04:25:14 UTC
cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util JavaScriptHelper.java
antonio 2003/12/30 19:25:14
Modified: src/blocks/woody/java/org/apache/cocoon/woody/util
JavaScriptHelper.java
Log:
Removing trailing white spaces
Revision Changes Path
1.3 +8 -16 cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/JavaScriptHelper.java
Index: JavaScriptHelper.java
===================================================================
RCS file: /home/cvs//cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/JavaScriptHelper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JavaScriptHelper.java 9 Oct 2003 09:34:37 -0000 1.2
+++ JavaScriptHelper.java 31 Dec 2003 03:25:14 -0000 1.3
@@ -72,12 +72,12 @@
* @version CVS $Id$
*/
public class JavaScriptHelper {
-
+
/**
* A shared root scope, avoiding to recreate a new one each time.
*/
private static Scriptable _rootScope = null;
-
+
/**
* Build a script with the content of a DOM element.
*
@@ -88,7 +88,7 @@
public static Script buildScript(Element element) throws IOException {
String jsText = DomHelper.getElementText(element);
String sourceName = DomHelper.getSystemIdLocation(element);
-
+
Context ctx = Context.enter();
Script script;
try {
@@ -102,10 +102,9 @@
} finally {
Context.exit();
}
-
return script;
}
-
+
/**
* Get a root scope for building child scopes.
*
@@ -121,11 +120,9 @@
Context.exit();
}
}
-
return _rootScope;
-
}
-
+
/**
* Get a parent scope for building a child scope. The request is searched for an existing scope
* that can be provided by a flowscript higher in the call stack, giving visibility to flowscript
@@ -151,9 +148,8 @@
public static Object execScript(Script script, Map values, Request request) throws JavaScriptException {
Context ctx = Context.enter();
try {
-
Scriptable parentScope = getParentScope(request);
-
+
// Create a new local scope for the event listener variables
Scriptable scope;
try {
@@ -162,9 +158,8 @@
// Should normally not happen
throw new CascadingRuntimeException("Cannont create script scope", e);
}
-
scope.setParentScope(parentScope);
-
+
// Populate the scope
Iterator iter = values.entrySet().iterator();
while(iter.hasNext()) {
@@ -173,12 +168,9 @@
Object value = entry.getValue();
scope.put(key, scope, Context.toObject(value, scope));
}
-
return script.exec(ctx, scope);
-
} finally {
Context.exit();
}
}
-
}