OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // For source without 'eval' there will be a compile events with the | 78 // For source without 'eval' there will be a compile events with the |
79 // exact source. | 79 // exact source. |
80 assertEquals(current_source, event_data.script().source()); | 80 assertEquals(current_source, event_data.script().source()); |
81 } | 81 } |
82 // Check that script context is included into the event message. | 82 // Check that script context is included into the event message. |
83 var json = event_data.toJSONProtocol(); | 83 var json = event_data.toJSONProtocol(); |
84 var msg = eval('(' + json + ')'); | 84 var msg = eval('(' + json + ')'); |
85 assertTrue('context' in msg.body.script); | 85 assertTrue('context' in msg.body.script); |
86 | 86 |
87 // Check that we pick script name from //# sourceURL, iff present | 87 // Check that we pick script name from //# sourceURL, iff present |
88 assertEquals(current_source.indexOf('sourceURL') >= 0 ? | 88 if (event == Debug.DebugEvent.AfterCompile) { |
89 'myscript.js' : undefined, | 89 assertEquals(current_source.indexOf('sourceURL') >= 0 ? |
90 event_data.script().name()); | 90 'myscript.js' : undefined, |
| 91 event_data.script().name()); |
| 92 } |
91 } | 93 } |
92 } catch (e) { | 94 } catch (e) { |
93 exception = e | 95 exception = e |
94 } | 96 } |
95 }; | 97 }; |
96 | 98 |
97 | 99 |
98 // Add the debug event listener. | 100 // Add the debug event listener. |
99 Debug.setListener(listener); | 101 Debug.setListener(listener); |
100 | 102 |
(...skipping 20 matching lines...) Expand all Loading... |
121 assertEquals(before_compile_count, after_compile_count + compile_error_count); | 123 assertEquals(before_compile_count, after_compile_count + compile_error_count); |
122 assertEquals(compile_error_count, 1); | 124 assertEquals(compile_error_count, 1); |
123 | 125 |
124 // Check the actual number of events (no compilation through the API as all | 126 // Check the actual number of events (no compilation through the API as all |
125 // source compiled through eval). | 127 // source compiled through eval). |
126 assertEquals(source_count, after_compile_count); | 128 assertEquals(source_count, after_compile_count); |
127 assertEquals(0, host_compilations); | 129 assertEquals(0, host_compilations); |
128 assertEquals(source_count, eval_compilations); | 130 assertEquals(source_count, eval_compilations); |
129 | 131 |
130 Debug.setListener(null); | 132 Debug.setListener(null); |
OLD | NEW |