| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // See: http://code.google.com/p/v8/issues/detail?id=1523 | 28 // See: http://code.google.com/p/v8/issues/detail?id=1523 |
| 29 | 29 |
| 30 // Flags: --expose-debug-as debug | 30 // Flags: --expose-debug-as debug |
| 31 // Get the Debug object exposed from the debug context global object. | 31 // Get the Debug object exposed from the debug context global object. |
| 32 | 32 |
| 33 Debug = debug.Debug | 33 Debug = debug.Debug; |
| 34 | 34 |
| 35 var listenerCalled = false; | 35 var listenerCalled = false; |
| 36 var result = -1; | 36 var result = -1; |
| 37 | 37 |
| 38 function listener(event, exec_state, event_data, data) { | 38 function listener(event, exec_state, event_data, data) { |
| 39 listenerCalled = true; | 39 listenerCalled = true; |
| 40 }; | 40 } |
| 41 | 41 |
| 42 // Add the debug event listener. | 42 // Add the debug event listener. |
| 43 Debug.setListener(listener); | 43 Debug.setListener(listener); |
| 44 | 44 |
| 45 function test_and(x) { | 45 function test_and(x) { |
| 46 if (x && (bar === this.baz)) | 46 if (x && (bar === this.baz)) { |
| 47 return 0; | 47 return 0; |
| 48 } |
| 48 return 1; | 49 return 1; |
| 49 } | 50 } |
| 50 | 51 |
| 51 function test_or(x) { | 52 function test_or(x) { |
| 52 if (x || (bar === this.baz)) | 53 if (x || (bar === this.baz)) { |
| 53 return 0; | 54 return 0; |
| 55 } |
| 54 return 1; | 56 return 1; |
| 55 } | 57 } |
| 56 | 58 |
| 57 // Set a break points and call each function to invoke the debug event listener. | 59 // Set a break points and call each function to invoke the debug event listener. |
| 58 Debug.setBreakPoint(test_and, 0, 0); | 60 Debug.setBreakPoint(test_and, 0, 0); |
| 59 Debug.setBreakPoint(test_or, 0, 0); | 61 Debug.setBreakPoint(test_or, 0, 0); |
| 60 | 62 |
| 61 listenerCalled = false; | 63 listenerCalled = false; |
| 62 result = test_and(false); | 64 result = test_and(false); |
| 63 assertEquals(1, result); | 65 assertEquals(1, result); |
| 64 assertTrue(listenerCalled); | 66 assertTrue(listenerCalled); |
| 65 | 67 |
| 66 listenerCalled = false; | 68 listenerCalled = false; |
| 67 result = test_or(true); | 69 result = test_or(true); |
| 68 assertEquals(0, result); | 70 assertEquals(0, result); |
| 69 assertTrue(listenerCalled); | 71 assertTrue(listenerCalled); |
| OLD | NEW |