Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.1.9, 2.2
-
None
-
Normal
-
Patch available
Description
Currently it is not possible to add variables to the scope of a FOM_JavaScriptInterpreter, unless the scope is not locked yet or when still in the main loading process or when loading native java classes. Therefore it is not possible to dynamically load JavaScript classes like the one below:.
-------------------------------
function myObject() { // at this point the current
implementation throws the exception
// constructor for myObject
}
myObject.prototype.myMethod = function() {
// implementation of myMethod
}
-------------------------------
from within a script fragment like this one:
-------------------------------
function loadScript() {
var scriptURI = "determineScriptURIFromRequest";
cocoon.load(scriptURI);
}
-------------------------------
The attached patch solves this by allowing also objects of the type org.mozilla.javascript.Function to be loaded into a locked scope.
-------------------------------
function myObject() { // at this point the current
implementation throws the exception
// constructor for myObject
}
myObject.prototype.myMethod = function() {
// implementation of myMethod
}
-------------------------------
from within a script fragment like this one:
-------------------------------
function loadScript() {
var scriptURI = "determineScriptURIFromRequest";
cocoon.load(scriptURI);
}
-------------------------------
The attached patch solves this by allowing also objects of the type org.mozilla.javascript.Function to be loaded into a locked scope.