OLD | NEW |
(Empty) | |
| 1 // Flags: --expose-debug-as debug |
| 2 // Get the Debug object exposed from the debug context global object. |
| 3 |
| 4 Debug = debug.Debug |
| 5 |
| 6 eval("var something1 = 25; " |
| 7 + " function ChooseAnimal() { return 'Cat'; } " |
| 8 + " ChooseAnimal.Helper = function() { return 'Help!'; }"); |
| 9 |
| 10 assertEquals("Cat", ChooseAnimal()); |
| 11 |
| 12 var script = Debug.findScript(ChooseAnimal); |
| 13 |
| 14 var orig_animal = "Cat"; |
| 15 var patch_pos = script.source.indexOf(orig_animal); |
| 16 var new_animal_patch = "Cap' + 'y' + 'bara"; |
| 17 |
| 18 Debug.change_script_live(script, patch_pos, orig_animal.length, new_animal_patch
); |
| 19 |
| 20 assertEquals("Capybara", ChooseAnimal()); |
OLD | NEW |