| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 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 // Flags: --expose-debug-as debug | 28 // Flags: --expose-debug-as debug |
| 29 // Get the Debug object exposed from the debug context global object. | 29 // Get the Debug object exposed from the debug context global object. |
| 30 Debug = debug.Debug | 30 Debug = debug.Debug; |
| 31 | 31 |
| 32 var evaluate_callback; | 32 var evaluate_callback; |
| 33 | 33 |
| 34 function listener(event, exec_state, event_data, data) { | 34 function listener(event, exec_state, event_data, data) { |
| 35 try { | 35 try { |
| 36 var context = { what_is_capybara: "a fish" }; | 36 var context = { what_is_capybara: "a fish" }; |
| 37 var context2 = { what_is_capybara: "a fish", what_is_parrot: "a beard" }; | 37 var context2 = { what_is_capybara: "a fish", what_is_parrot: "a beard" }; |
| 38 | 38 |
| 39 // Try in frame's scope. | 39 // Try in frame's scope. |
| 40 var local_expression = | 40 var local_expression = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 66 var result = evaluate_callback.globally(exec_state, global_expression2, void
0); | 66 var result = evaluate_callback.globally(exec_state, global_expression2, void
0); |
| 67 assertEquals('cat/undefined', result); | 67 assertEquals('cat/undefined', result); |
| 68 | 68 |
| 69 // Try in global scope without additional context. | 69 // Try in global scope without additional context. |
| 70 var global_expression3 = "'cat' + '/' + 'dog'"; | 70 var global_expression3 = "'cat' + '/' + 'dog'"; |
| 71 var result = evaluate_callback.globally(exec_state, global_expression3, void
0); | 71 var result = evaluate_callback.globally(exec_state, global_expression3, void
0); |
| 72 assertEquals('cat/dog', result); | 72 assertEquals('cat/dog', result); |
| 73 | 73 |
| 74 listenerComplete = true; | 74 listenerComplete = true; |
| 75 } catch (e) { | 75 } catch (e) { |
| 76 exception = e | 76 exception = e; |
| 77 }; | 77 } |
| 78 }; | 78 } |
| 79 | 79 |
| 80 | 80 |
| 81 function f() { | 81 function f() { |
| 82 var what_is_parrot = "a bird"; | 82 var what_is_parrot = "a bird"; |
| 83 debugger; | 83 debugger; |
| 84 }; | 84 } |
| 85 | 85 |
| 86 function runF() { | 86 function runF() { |
| 87 exception = false; | 87 exception = false; |
| 88 listenerComplete = false; | 88 listenerComplete = false; |
| 89 | 89 |
| 90 Debug.setListener(listener); | 90 Debug.setListener(listener); |
| 91 | 91 |
| 92 // Add the debug event listener. | 92 // Add the debug event listener. |
| 93 Debug.setListener(listener); | 93 Debug.setListener(listener); |
| 94 | 94 |
| 95 f(); | 95 f(); |
| 96 | 96 |
| 97 assertFalse(exception, "exception in listener") | 97 assertFalse(exception, "exception in listener"); |
| 98 assertTrue(listenerComplete); | 98 assertTrue(listenerComplete); |
| 99 } | 99 } |
| 100 | 100 |
| 101 evaluate_callback = { | 101 evaluate_callback = { |
| 102 in_top_frame: function(exec_state, expression, additional_context) { | 102 in_top_frame: function(exec_state, expression, additional_context) { |
| 103 return exec_state.frame(0).evaluate(expression, void 0, additional_context).
value(); | 103 return exec_state.frame(0).evaluate(expression, void 0, additional_context).
value(); |
| 104 }, | 104 }, |
| 105 globally: function(exec_state, expression, additional_context) { | 105 globally: function(exec_state, expression, additional_context) { |
| 106 return exec_state.evaluateGlobal(expression, void 0, additional_context).val
ue(); | 106 return exec_state.evaluateGlobal(expression, void 0, additional_context).val
ue(); |
| 107 }, | 107 }, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 135 evaluate_callback = { | 135 evaluate_callback = { |
| 136 in_top_frame: function(exec_state, expression, additional_context) { | 136 in_top_frame: function(exec_state, expression, additional_context) { |
| 137 return evaluateViaProtocol(exec_state, expression, additional_context, funct
ion(args) { args.frame = 0; }); | 137 return evaluateViaProtocol(exec_state, expression, additional_context, funct
ion(args) { args.frame = 0; }); |
| 138 }, | 138 }, |
| 139 globally: function(exec_state, expression, additional_context) { | 139 globally: function(exec_state, expression, additional_context) { |
| 140 return evaluateViaProtocol(exec_state, expression, additional_context, funct
ion(args) { args.global = true; }); | 140 return evaluateViaProtocol(exec_state, expression, additional_context, funct
ion(args) { args.global = true; }); |
| 141 }, | 141 }, |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 runF(); | 144 runF(); |
| OLD | NEW |