| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 var got_exception = false; | 54 var got_exception = false; |
| 55 var successfully_changed = false; | 55 var successfully_changed = false; |
| 56 | 56 |
| 57 // Should be called from Debug context. | 57 // Should be called from Debug context. |
| 58 this.ScriptChanger = function() { | 58 this.ScriptChanger = function() { |
| 59 assertEquals(false, successfully_changed, "applying patch second time"); | 59 assertEquals(false, successfully_changed, "applying patch second time"); |
| 60 // Runs in debugger context. | 60 // Runs in debugger context. |
| 61 var change_log = new Array(); | 61 var change_log = new Array(); |
| 62 try { | 62 try { |
| 63 Debug.LiveEditChangeScript(script, patch_pos, orig_animal.length, new_anim
al_patch, change_log); | 63 Debug.LiveEdit.ApplyPatch(script, patch_pos, orig_animal.length, new_anima
l_patch, change_log); |
| 64 } finally { | 64 } finally { |
| 65 print("Change log: " + JSON.stringify(change_log) + "\n"); | 65 print("Change log: " + JSON.stringify(change_log) + "\n"); |
| 66 } | 66 } |
| 67 successfully_changed = true; | 67 successfully_changed = true; |
| 68 }; | 68 }; |
| 69 } | 69 } |
| 70 | 70 |
| 71 function Noop() {} | 71 function Noop() {} |
| 72 | 72 |
| 73 function WrapInCatcher(f, holder) { | 73 function WrapInCatcher(f, holder) { |
| 74 return function() { | 74 return function() { |
| 75 delete holder[0]; | 75 delete holder[0]; |
| 76 try { | 76 try { |
| 77 f(); | 77 f(); |
| 78 } catch (e) { | 78 } catch (e) { |
| 79 if (e instanceof Debug.LiveEditChangeScript.Failure) { | 79 if (e instanceof Debug.LiveEdit.Failure) { |
| 80 holder[0] = e; | 80 holder[0] = e; |
| 81 } else { | 81 } else { |
| 82 throw e; | 82 throw e; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 }; | 85 }; |
| 86 } | 86 } |
| 87 | 87 |
| 88 function WrapInNativeCall(f) { | 88 function WrapInNativeCall(f) { |
| 89 return function() { | 89 return function() { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 | 133 |
| 134 test = new TestBase("Test with function on stack and with constructor frame"); | 134 test = new TestBase("Test with function on stack and with constructor frame"); |
| 135 assertEquals("Capybara", test.ChooseAnimal(WrapInConstructor(WrapInDebuggerCall(
WrapInRestartProof(test.ScriptChanger))))); | 135 assertEquals("Capybara", test.ChooseAnimal(WrapInConstructor(WrapInDebuggerCall(
WrapInRestartProof(test.ScriptChanger))))); |
| 136 | 136 |
| 137 test = new TestBase("Test with C++ frame above ChooseAnimal frame"); | 137 test = new TestBase("Test with C++ frame above ChooseAnimal frame"); |
| 138 exception_holder = {}; | 138 exception_holder = {}; |
| 139 assertEquals("Cat", test.ChooseAnimal(WrapInNativeCall(WrapInDebuggerCall(WrapIn
Catcher(test.ScriptChanger, exception_holder))))); | 139 assertEquals("Cat", test.ChooseAnimal(WrapInNativeCall(WrapInDebuggerCall(WrapIn
Catcher(test.ScriptChanger, exception_holder))))); |
| 140 assertTrue(!!exception_holder[0]); | 140 assertTrue(!!exception_holder[0]); |
| 141 | 141 |
| OLD | NEW |