diff --git a/core/pom.xml b/core/pom.xml
index e8b5425bdfbfce74c9cb91a988f86a28cfd67c51..7b49cf7be20c24757b1aeedef56d36301d356450 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -42,7 +42,7 @@ THE SOFTWARE.
true
- 1.197
+ 1.198
diff --git a/core/src/main/java/hudson/widgets/RenderOnDemandClosure.java b/core/src/main/java/hudson/widgets/RenderOnDemandClosure.java
index 6bc55c3914aafe8799b2f19720e5533d4d91e8d5..13ebee6de4ae27e4a59b2e5db998ecb0346b5306 100644
--- a/core/src/main/java/hudson/widgets/RenderOnDemandClosure.java
+++ b/core/src/main/java/hudson/widgets/RenderOnDemandClosure.java
@@ -37,7 +37,9 @@ import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.bind.JavaScriptMethod;
+import org.kohsuke.stapler.framework.adjunct.AdjunctsInPage;
import org.kohsuke.stapler.jelly.DefaultScriptInvoker;
+import org.xml.sax.SAXException;
import javax.servlet.ServletException;
import java.io.IOException;
@@ -45,6 +47,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -61,6 +64,8 @@ public class RenderOnDemandClosure {
private final Map variables;
private final String currentDescriptorByNameUrl;
+ private final Set adjuncts;
+
public RenderOnDemandClosure(JellyContext context, String attributesToCapture) {
List
+
diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js
index f8f58fda7d1b8b26f23eed574b70c55e312cf761..c88fc9f4d06939b3fb4a3e17062faeef7e0a1a77 100644
--- a/war/src/main/webapp/scripts/hudson-behavior.js
+++ b/war/src/main/webapp/scripts/hudson-behavior.js
@@ -364,6 +364,14 @@ function parseHtml(html) {
return c.firstChild;
}
+/**
+ * Evaluates the script in global context.
+ */
+function geval(script) {
+ // see http://perfectionkills.com/global-eval-what-are-the-options/
+ return (this.execScript || eval)(script);
+}
+
/**
* Emulate the firing of an event.
*
@@ -396,7 +404,7 @@ var tooltip;
function registerValidator(e) {
e.targetElement = findFollowingTR(e, "validation-error-area").firstChild.nextSibling;
e.targetUrl = function() {
- return eval(this.getAttribute("checkUrl"));
+ return eval(this.getAttribute("checkUrl")); // need access to 'this'
};
var method = e.getAttribute("checkMethod");
if (!method) method = "get";
@@ -492,7 +500,7 @@ function isInsideRemovable(e) {
*/
function renderOnDemand(e,callback,noBehaviour) {
if (!e || !Element.hasClassName(e,"render-on-demand")) return;
- var proxy = eval(e.getAttribute("proxy"));
+ var proxy = geval(e.getAttribute("proxy"));
proxy.render(function (t) {
var contextTagName = e.parentNode.tagName;
var c;
@@ -537,7 +545,7 @@ function evalInnerHtmlScripts(text,callback) {
});
} else {
q.push(function(cont) {
- eval(s.match(matchOne)[2]);
+ geval(s.match(matchOne)[2]);
cont();
});
}
@@ -708,7 +716,7 @@ var jenkinsRules = {
(function() {
var cmdKeyDown = false;
var mode = e.getAttribute("script-mode") || "text/x-groovy";
- var readOnly = eval(e.getAttribute("script-readOnly")) || false;
+ var readOnly = geval(e.getAttribute("script-readOnly")) || false;
var w = CodeMirror.fromTextArea(e,{
mode: mode,
@@ -2134,7 +2142,7 @@ function validateButton(checkUrl,paramList,button) {
var s = rsp.getResponseHeader("script");
if(s!=null)
try {
- eval(s);
+ geval(s);
} catch(e) {
window.alert("failed to evaluate "+s+"\n"+e.message);
}