| Summary: | "var" variables in user .cfg files modify xdc.global in XGCONF | ||
|---|---|---|---|
| Product: | [Technology] RTSC | Reporter: | Jon Rowlands <rowlands> |
| Component: | Core | Assignee: | Sasha Slijepcevic <sascha> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | d-russo, rowlands |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | All | ||
| Whiteboard: | target:3.22.03 | ||
A similar problem was addressed in SDOCM46701. - fixed in xdc-x00
The code in the generated cfg script
evaluateScript(script);
is replaced with
try {
var tempScope = {};
var cx = Packages.org.mozilla.javascript.Context.getCurrentContext();
var rdr = new java.io.BufferedReader(new java.io.StringReader(script));
Packages.config.Shell.evaluateLoad(cx, tempScope, rdr, "", 1);
}
finally {
rdr.close();
}
closing "ancient" resolved bugs |
XGCONF incorrectly executes the user .cfg using xdc.global scope, instead of in a capsule scope. This modifies the JavaScript execution environment for everyone. For example, the following causes failures: var Error = xdc.useModule("xdc.runtime.Error"); Subsequently, .xs code in other packages that uses the standard JavaScript expression "throw new Error()" will fail as: xdc.services.intern.xsr.Value$Obj@1d43d1e:: xdc.runtime.Error is not a function, it is object. The root cause is inappropriate use of utils.evaluateScript() in the generated .cfg file, function _loadOrEval(). Should replace with some function that lets the caller specify a scope.