Fix eval()
Example code, dynamic Javascript eval
// Load the code dynamically
var req = new XMLHttpRequest();
req.open('GET','payloadCatsAndDucks.js', false);
req.send(null);
eval( req.responseText ); // line 23
// Now use the code
prod( new duck() );
prod( new cat() );
prod(); // call point of error
eval() in Firebug 1.0
// Load the code dynamically
var req = new XMLHttpRequest();
req.open('GET','payloadCatsAndDucks.js', false);
req.send(null);
eval( req.responseText); // line 23
function prod( animal) { // line 24
// Now use the code animal.say();
prod( new duck()); };
prod( new cat());
prod(); // call point of error var duck = function() {
this.say = function() {
dump('quack\n');
};
}
var cat = function() {
this.say = function() {
dump('meow\n');
};
}
The eval() code looks overlaid on caller