| // Copyright 2016 the V8 project authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // Flags: --allow-natives-syntax |
| function listener(event, exec_state, event_data, data) { |
| if (event != Debug.DebugEvent.Exception) return; |
| var source_line = event_data.sourceLineText(); |
| switch (results.length) { |
| Replace(BestEditor, "Emacs", "Eclipse"); |
| Replace(BestEditor, "Eclipse", "Vim"); |
| function Replace(fun, original, patch) { |
| if (fun.toString().indexOf(original) < 0) return; |
| %LiveEditPatchScript(fun, Debug.scriptSource(fun).replace(original, patch)); |
| Debug.setListener(listener); |
| Debug.setBreakOnException(); |
| for (var i = 0; i < 3; i++) { |
| assertEquals(["Emacs", "Eclipse", "Vim"], results); |
| print(JSON.stringify(log, 1)); |