Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: test/mjsunit/debug-stepin-builtin-callback.js

Issue 10134006: Disabling stepping into callback function of String.replace. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/string.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 Debug.setListener(second_level_listener); 149 Debug.setListener(second_level_listener);
150 150
151 breaks = 0; 151 breaks = 0;
152 debugger; 152 debugger;
153 a.forEach(cb_foreach); 153 a.forEach(cb_foreach);
154 assertFalse(exception); 154 assertFalse(exception);
155 assertEquals(17, breaks); 155 assertEquals(17, breaks);
156 156
157 Debug.setListener(null); 157 Debug.setListener(null);
158
159
160 //Test replace callback in String.replace.
161
162 function replace_listener(event, exec_state, event_data, data) {
163 try {
164 if (event == Debug.DebugEvent.Break) {
165 if (breaks == 0) {
166 exec_state.prepareStep(Debug.StepAction.StepIn, 2);
167 breaks = 1;
168 } else {
169 // Check whether we break at the expected line.
170 assertTrue(event_data.sourceLineText().indexOf("Expected to step") > 0);
171 }
172 }
173 } catch (e) {
174 exception = true;
175 }
176 };
177
178 function cb_replace(match) {
179 print("matching string: " + match); // Expected to step to this point.
180 return "_";
181 }
182
183 var s = "abcdefgehijke";
184
185 Debug.setListener(replace_listener);
186
187 breaks = 0;
188 debugger;
189 assertEquals("ab_defgehijke", s.replace("c", cb_replace));
190 assertFalse(exception);
191 assertEquals(1, breaks);
192
193 breaks = 0;
194 debugger;
195 assertEquals("abcdefgehij_", s.replace(/..$/, cb_replace));
196 assertFalse(exception);
197 assertEquals(1, breaks);
198
199 breaks = 0;
200 debugger;
201 assertEquals("abcd_fg_hijk_", s.replace(/e/g, cb_replace));
202 assertFalse(exception);
203 assertEquals(1, breaks);
204
205
206 Debug.setListener(null);
OLDNEW
« no previous file with comments | « src/string.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698