@@ -164,21 +164,49 @@ Selenium.prototype.doStoreEval = function(value, varName) {
164164} ; 
165165
166166Selenium . prototype . doPrePageWait  =  function ( )  { 
167-     window . zeuz_new_page  =  window . eval ( '(function() {return window.new_page;}())' ) ; 
167+     // The following code is untested!! just replaced Eval() 
168+     // window.zeuz_new_page = window.eval('(function() {return window.new_page;}())'); 
169+     window . zeuz_new_page  =  window . new_page ; ; 
168170} ; 
169171Selenium . prototype . doPageWait  =  function ( )  { 
170-     var  expression  =  'if(window.document.readyState=="complete"){return true;}else{return false;}' ; 
171-     window . zeuz_page_done  =  window . eval ( '(function() {'  +  expression  +  '}())' ) ; 
172+     // The following code is untested!! just replaced Eval() 
173+     // var expression = 'if(window.document.readyState=="complete"){return true;}else{return false;}'; 
174+     // window.zeuz_page_done = window.eval('(function() {' + expression + '}())'); 
175+     window . zeuz_page_done  =  window . document . readyState == "complete" ; 
172176} ; 
173177
174178Selenium . prototype . doAjaxWait  =  function ( )  { 
175-     var  expression  =  'if (window.ajax_obj) { if (window.ajax_obj.length == 0) {return true;} else {\ 
176-                       for (var index in window.ajax_obj) {\ 
177-                       if (window.ajax_obj[index].readyState !== 4 &&\ 
178-                       window.ajax_obj[index].readyState !== undefined &&\ 
179-                       window.ajax_obj[index].readyState !== 0) {return false;}}return true;}}\ 
180-                       else {if (window.origXMLHttpRequest) {window.origXMLHttpRequest = "";}return true;}' ; 
181-     window . zeuz_ajax_done  =  window . eval ( '(function() {'  +  expression  +  '}())' ) ; 
179+     // var expression = 'if (window.ajax_obj) { if (window.ajax_obj.length == 0) {return true;} else {\ 
180+     //                   for (var index in window.ajax_obj) {\ 
181+     //                   if (window.ajax_obj[index].readyState !== 4 &&\ 
182+     //                   window.ajax_obj[index].readyState !== undefined &&\ 
183+     //                   window.ajax_obj[index].readyState !== 0) {return false;} }return true; }}\ 
184+     //                   else {if (window.origXMLHttpRequest) {window.origXMLHttpRequest = "";}return true; }'; 
185+     // window.zeuz_ajax_done = window.eval('(function() {' + expression + '}())'); 
186+ 
187+     // The following code is untested!! just replaced Eval() 
188+     if  ( window . ajax_obj )  {  
189+         if  ( window . ajax_obj . length  ==  0 )  { 
190+             window . zeuz_ajax_done =  true ; 
191+         }  
192+         else  { 
193+             for  ( var  index  in  window . ajax_obj )  { 
194+                 if  ( window . ajax_obj [ index ] . readyState  !==  4  && 
195+                 window . ajax_obj [ index ] . readyState  !==  undefined  && 
196+                 window . ajax_obj [ index ] . readyState  !==  0 )  { 
197+                     window . zeuz_ajax_done  =  false ; 
198+                     break ; 
199+                 } 
200+             } 
201+             return  true ; 
202+         } 
203+     } 
204+     else  { 
205+         if  ( window . origXMLHttpRequest )  { 
206+             window . origXMLHttpRequest  =  "" ; 
207+         } 
208+         window . zeuz_ajax_done  =  true ;  
209+     } ; 
182210} ; 
183211
184212Selenium . createForWindow  =  function ( window ,  proxyInjectionMode )  { 
@@ -190,24 +218,49 @@ Selenium.createForWindow = function(window, proxyInjectionMode) {
190218
191219
192220Selenium . prototype . doWaitPreparation  =  function ( )  { 
193-     window . eval ( 'function setNewPageValue(e) {window.new_page = true;};\ 
194-                 window.addEventListener("beforeunload", setNewPageValue, false);\ 
195-                 if (window.XMLHttpRequest) {if (!window.origXMLHttpRequest || !window.ajax_obj) {\ 
196-                 window.ajax_obj = []; window.origXMLHttpRequest = window.XMLHttpRequest;\ 
197-                 window.XMLHttpRequest = function() { var xhr = new window.origXMLHttpRequest();\ 
198-                 window.ajax_obj.push(xhr); return xhr;}}} function setDOMModifiedTime() {\ 
199-                 window.domModifiedTime = Date.now();}var _win = window.document.body;\ 
200-                 _win.addEventListener("DOMNodeInserted", setDOMModifiedTime, false);\ 
201-                 _win.addEventListener("DOMNodeInsertedIntoDocument", setDOMModifiedTime, false);\ 
202-                 _win.addEventListener("DOMNodeRemoved", setDOMModifiedTime, false);\ 
203-                 _win.addEventListener("DOMNodeRemovedFromDocument", setDOMModifiedTime, false);\ 
204-                 _win.addEventListener("DOMSubtreeModified", setDOMModifiedTime, false);' ) ; 
221+     // window.eval('function setNewPageValue(e) {window.new_page = true;};\ 
222+     //             window.addEventListener("beforeunload", setNewPageValue, false);\ 
223+     //             if (window.XMLHttpRequest) {if (!window.origXMLHttpRequest || !window.ajax_obj) {\ 
224+     //             window.ajax_obj = []; window.origXMLHttpRequest = window.XMLHttpRequest;\ 
225+     //             window.XMLHttpRequest = function() { var xhr = new window.origXMLHttpRequest();\ 
226+     //             window.ajax_obj.push(xhr); return xhr; }}} function setDOMModifiedTime() {\ 
227+     //             window.domModifiedTime = Date.now(); }var _win = window.document.body;\ 
228+     //             _win.addEventListener("DOMNodeInserted", setDOMModifiedTime, false);\ 
229+     //             _win.addEventListener("DOMNodeInsertedIntoDocument", setDOMModifiedTime, false);\ 
230+     //             _win.addEventListener("DOMNodeRemoved", setDOMModifiedTime, false);\ 
231+     //             _win.addEventListener("DOMNodeRemovedFromDocument", setDOMModifiedTime, false);\ 
232+     //             _win.addEventListener("DOMSubtreeModified", setDOMModifiedTime, false);'); 
233+ 
234+     // The following code is untested!! just replaced Eval() 
235+     function  setNewPageValue ( e )  { 
236+         window . new_page  =  true ; 
237+     } ; 
238+     window . addEventListener ( "beforeunload" ,  setNewPageValue ,  false ) ; 
239+     if  ( window . XMLHttpRequest )  { 
240+         if  ( ! window . origXMLHttpRequest  ||  ! window . ajax_obj )  { 
241+             window . ajax_obj  =  [ ] ;  window . origXMLHttpRequest  =  window . XMLHttpRequest ; 
242+             window . XMLHttpRequest  =  function ( )  {  var  xhr  =  new  window . origXMLHttpRequest ( ) ; 
243+             window . ajax_obj . push ( xhr ) ;  return  xhr ; } 
244+         } 
245+     } 
246+     function  setDOMModifiedTime ( )  { 
247+         window . domModifiedTime  =  Date . now ( ) ; 
248+     } 
249+     var  _win  =  window . document . body ; 
250+     _win . addEventListener ( "DOMNodeInserted" ,  setDOMModifiedTime ,  false ) ; 
251+     _win . addEventListener ( "DOMNodeInsertedIntoDocument" ,  setDOMModifiedTime ,  false ) ; 
252+     _win . addEventListener ( "DOMNodeRemoved" ,  setDOMModifiedTime ,  false ) ; 
253+     _win . addEventListener ( "DOMNodeRemovedFromDocument" ,  setDOMModifiedTime ,  false ) ; 
254+     _win . addEventListener ( "DOMSubtreeModified" ,  setDOMModifiedTime ,  false ) ; 
205255} ; 
206256
207257
208258Selenium . prototype . doDomWait  =  function ( )  { 
209259    //sdx 
210-     window . zeuz_dom_time  =  window . eval ( '(function() {return window.domModifiedTime;}())' ) ; 
260+     // window.zeuz_dom_time = window.eval('(function() {return window.domModifiedTime;}())'); 
261+     // The following code is untested!! just replaced Eval() 
262+ 
263+     window . zeuz_dom_time  =  window . domModifiedTime ; 
211264} ; 
212265
213266Selenium . prototype . doClick  =  function ( locator )  { 
@@ -783,16 +836,18 @@ Selenium.prototype.doHighlight = function(locator) {
783836    this . browserbot . highlight ( element ,  true ) ; 
784837} ; 
785838
786- Selenium . prototype . getEval  =  function ( script )  { 
787-     try  { 
788-         var  window  =  this . browserbot . getCurrentWindow ( ) ; 
789-         var  result  =  eval ( script ) ; 
790-         if  ( null  ==  result )  return  "null" ; 
791-         return  result ; 
792-     }  catch  ( e )  { 
793-         throw  new  SeleniumError ( "Threw an exception: "  +  extractExceptionMessage ( e ) ) ; 
794-     } 
795- } ; 
839+ // The following code is untested!! just replaced Eval() 
840+ 
841+ // Selenium.prototype.getEval = function(script) { 
842+ //     try { 
843+ //         var window = this.browserbot.getCurrentWindow(); 
844+ //         var result = eval(script); 
845+ //         if (null == result) return "null"; 
846+ //         return result; 
847+ //     } catch (e) { 
848+ //         throw new SeleniumError("Threw an exception: " + extractExceptionMessage(e)); 
849+ //     } 
850+ // }; 
796851
797852Selenium . prototype . isChecked  =  function ( locator )  { 
798853    var  element  =  this . browserbot . findElement ( locator ) ; 
@@ -1038,47 +1093,52 @@ Selenium.prototype.getAllFields = function() {
10381093    return  this . browserbot . getAllFields ( ) ; 
10391094} ; 
10401095
1041- Selenium . prototype . getAttributeFromAllWindows  =  function ( attributeName )  { 
1042-     var  attributes  =  new  Array ( ) ; 
1043- 
1044-     var  win  =  selenium . browserbot . topWindow ; 
1045-     try  { 
1046-         attributes . push ( eval ( "win."  +  attributeName ) ) ; 
1047-     }  catch  ( ignored )  { 
1048-     } 
1049-     for  ( var  windowName  in  this . browserbot . openedWindows )  { 
1050-         try  { 
1051-             win  =  selenium . browserbot . openedWindows [ windowName ] ; 
1052-             if  ( ! selenium . browserbot . _windowClosed ( win ) )  { 
1053-                 attributes . push ( eval ( "win."  +  attributeName ) ) ; 
1054-             } 
1055-         }  catch  ( e )  { } 
1056-     } 
1057-     return  attributes ; 
1058- } ; 
1059- 
1060- Selenium . prototype . findWindow  =  function ( soughtAfterWindowPropertyValue )  { 
1061-     var  targetPropertyName  =  "name" ; 
1062-     if  ( soughtAfterWindowPropertyValue . match ( "^title=" ) )  { 
1063-         targetPropertyName  =  "document.title" ; 
1064-         soughtAfterWindowPropertyValue  =  soughtAfterWindowPropertyValue . replace ( / ^ t i t l e = / ,  "" ) ; 
1065-     }  else  { 
1066-         if  ( PatternMatcher . matches ( soughtAfterWindowPropertyValue ,  "" ) )  { 
1067-             return  this . browserbot . getCurrentWindow ( ) ; 
1068-         } 
1069-     } 
1070- 
1071-     if  ( PatternMatcher . matches ( soughtAfterWindowPropertyValue ,  eval ( "this.browserbot.topWindow."  +  targetPropertyName ) ) )  { 
1072-         return  this . browserbot . topWindow ; 
1073-     } 
1074-     for  ( windowName  in  selenium . browserbot . openedWindows )  { 
1075-         var  openedWindow  =  selenium . browserbot . openedWindows [ windowName ] ; 
1076-         if  ( PatternMatcher . matches ( soughtAfterWindowPropertyValue ,  eval ( "openedWindow."  +  targetPropertyName ) ) )  { 
1077-             return  openedWindow ; 
1078-         } 
1079-     } 
1080-     throw  new  SeleniumError ( "could not find window with property "  +  targetPropertyName  +  " matching "  +  soughtAfterWindowPropertyValue ) ; 
1081- } ; 
1096+ // The following code is untested!! just replaced Eval() 
1097+ 
1098+ // Selenium.prototype.getAttributeFromAllWindows = function(attributeName) { 
1099+ //     var attributes = new Array(); 
1100+ 
1101+ //     var win = selenium.browserbot.topWindow; 
1102+ //     try { 
1103+ //         attributes.push(eval("win." + attributeName)); 
1104+ //     } catch (ignored) { 
1105+ //     } 
1106+ //     for (var windowName in this.browserbot.openedWindows) { 
1107+ //         try { 
1108+ //             win = selenium.browserbot.openedWindows[windowName]; 
1109+ //             if (!selenium.browserbot._windowClosed(win)) { 
1110+ //                 attributes.push(eval("win." + attributeName)); 
1111+ //             } 
1112+ //         } catch (e) {} 
1113+ //     } 
1114+ //     return attributes; 
1115+ // }; 
1116+ 
1117+ 
1118+ // The following code is untested!! just replaced Eval() 
1119+ 
1120+ // Selenium.prototype.findWindow = function(soughtAfterWindowPropertyValue) { 
1121+ //     var targetPropertyName = "name"; 
1122+ //     if (soughtAfterWindowPropertyValue.match("^title=")) { 
1123+ //         targetPropertyName = "document.title"; 
1124+ //         soughtAfterWindowPropertyValue = soughtAfterWindowPropertyValue.replace(/^title=/, ""); 
1125+ //     } else { 
1126+ //         if (PatternMatcher.matches(soughtAfterWindowPropertyValue, "")) { 
1127+ //             return this.browserbot.getCurrentWindow(); 
1128+ //         } 
1129+ //     } 
1130+ 
1131+ //     if (PatternMatcher.matches(soughtAfterWindowPropertyValue, eval("this.browserbot.topWindow." + targetPropertyName))) { 
1132+ //         return this.browserbot.topWindow; 
1133+ //     } 
1134+ //     for (windowName in selenium.browserbot.openedWindows) { 
1135+ //         var openedWindow = selenium.browserbot.openedWindows[windowName]; 
1136+ //         if (PatternMatcher.matches(soughtAfterWindowPropertyValue, eval("openedWindow." + targetPropertyName))) { 
1137+ //             return openedWindow; 
1138+ //         } 
1139+ //     } 
1140+ //     throw new SeleniumError("could not find window with property " + targetPropertyName + " matching " + soughtAfterWindowPropertyValue); 
1141+ // }; 
10821142
10831143Selenium . prototype . doSetMouseSpeed  =  function ( pixels )  { 
10841144    var  intValue  =  new  Number ( pixels ) ; 
@@ -1408,7 +1468,8 @@ Selenium.prototype.doIgnoreAttributesWithoutValue = function(ignore) {
14081468Selenium . prototype . doWaitForCondition  =  function ( script ,  timeout )  { 
14091469    return  Selenium . decorateFunctionWithTimeout ( function ( )  { 
14101470        var  window  =  selenium . browserbot . getCurrentWindow ( ) ; 
1411-         return  eval ( script ) ; 
1471+         // The following code is untested!! just replaced Eval() 
1472+         // return eval(script); 
14121473    } ,  timeout ) ; 
14131474} ; 
14141475
@@ -1443,14 +1504,16 @@ Selenium.prototype._abortXhrRequest = function() {
14431504
14441505Selenium . prototype . doWaitForPageToLoad . dontCheckAlertsAndConfirms  =  true ; 
14451506
1446- Selenium . prototype . preprocessParameter  =  function ( value )  { 
1447-     var  match  =  value . match ( / ^ j a v a s c r i p t \{ ( ( .| \r ? \n ) + ) \} $ / ) ; 
1448-     if  ( match  &&  match [ 1 ] )  { 
1449-         var  result  =  eval ( match [ 1 ] ) ; 
1450-         return  result  ==  null  ? null  : result . toString ( ) ; 
1451-     } 
1452-     return  this . replaceVariables ( value ) ; 
1453- } ; 
1507+ // The following code is untested!! just replaced Eval() 
1508+ 
1509+ // Selenium.prototype.preprocessParameter = function(value) { 
1510+ //     var match = value.match(/^javascript\{((.|\r?\n)+)\}$/); 
1511+ //     if (match && match[1]) { 
1512+ //         var result = eval(match[1]); 
1513+ //         return result == null ? null : result.toString(); 
1514+ //     } 
1515+ //     return this.replaceVariables(value); 
1516+ // }; 
14541517
14551518Selenium . prototype . replaceVariables  =  function ( str )  { 
14561519    var  stringResult  =  str ; 
0 commit comments