Repository: wicket
Updated Branches:
  refs/heads/wicket-6.x e417c2727 -> 330ba3b31


WICKET-6085 eval in global scope, to prevent leak of local variables into the 
evaluated script


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/330ba3b3
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/330ba3b3
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/330ba3b3

Branch: refs/heads/wicket-6.x
Commit: 330ba3b31aafffb0f39c5f41c391cb0f9b7726da
Parents: e417c27
Author: Sven Meier <[email protected]>
Authored: Sat Feb 6 00:18:15 2016 +0100
Committer: Sven Meier <[email protected]>
Committed: Sat Feb 6 00:18:15 2016 +0100

----------------------------------------------------------------------
 .../org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js  | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/330ba3b3/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index a03a3f3..d0fa7e3 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ 
b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -1203,8 +1203,8 @@
                                        var toExecute = "f = function(" + 
parameters + ") {" + body + "};";
 
                                        try {
-                                               // do the evaluation
-                                               eval(toExecute);
+                                               // do the evaluation in global 
scope
+                                               window.eval(toExecute);
                                                f(notify);
                                        } catch (exception) {
                                                
log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: 
" + exception + ", text: " + text);
@@ -1217,8 +1217,8 @@
                                return function(notify) {
                                        // just evaluate the javascript
                                        try {
-                                               // do the evaluation
-                                               eval(script);
+                                               // do the evaluation in global 
scope
+                                               window.eval(script);
                                        } catch (exception) {
                                                
log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: 
" + exception + ", text: " + text);
                                        }
@@ -2290,7 +2290,8 @@
                                                                
Wicket.Head.addJavascript(text, id, "", type);
                                                        } else {
                                                                try {
-                                                                       
eval(text);
+                                                                       // do 
the evaluation in global scope
+                                                                       
window.eval(text);
                                                                } catch (e) {
                                                                        
Wicket.Log.error("Wicket.Head.Contributor.processScript: " + e + ": eval -> " + 
text);
                                                                }

Reply via email to