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

Side by Side Diff: pkg/stack_trace/lib/src/trace.dart

Issue 136693006: Support Safari 6.1 stack traces with blank lines in pkg/stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 | « no previous file | pkg/stack_trace/test/trace_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library trace; 5 library trace;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'chain.dart'; 10 import 'chain.dart';
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 /// This will automatically decide between [parseSafari6_0] and 157 /// This will automatically decide between [parseSafari6_0] and
158 /// [parseSafari6_1] based on the contents of [trace]. 158 /// [parseSafari6_1] based on the contents of [trace].
159 factory Trace.parseSafari(String trace) { 159 factory Trace.parseSafari(String trace) {
160 if (trace.contains(_safariTrace)) return new Trace.parseSafari6_1(trace); 160 if (trace.contains(_safariTrace)) return new Trace.parseSafari6_1(trace);
161 return new Trace.parseSafari6_0(trace); 161 return new Trace.parseSafari6_0(trace);
162 } 162 }
163 163
164 /// Parses a string representation of a Safari 6.1+ stack trace. 164 /// Parses a string representation of a Safari 6.1+ stack trace.
165 Trace.parseSafari6_1(String trace) 165 Trace.parseSafari6_1(String trace)
166 : this(trace.trim().split("\n") 166 : this(trace.trim().split("\n")
167 .where((line) => line.isNotEmpty)
167 .map((line) => new Frame.parseSafari6_1(line))); 168 .map((line) => new Frame.parseSafari6_1(line)));
168 169
169 /// Parses a string representation of a Safari 6.0 stack trace. 170 /// Parses a string representation of a Safari 6.0 stack trace.
170 /// 171 ///
171 /// Safari 6.0 stack traces look just like Firefox traces, except that they 172 /// Safari 6.0 stack traces look just like Firefox traces, except that they
172 /// sometimes (e.g. in isolates) have a "[native code]" frame. We just ignore 173 /// sometimes (e.g. in isolates) have a "[native code]" frame. We just ignore
173 /// this frame to make the stack format more consistent between browsers. 174 /// this frame to make the stack format more consistent between browsers.
174 /// Prior to Safari 6.0, stack traces can't be retrieved. 175 /// Prior to Safari 6.0, stack traces can't be retrieved.
175 Trace.parseSafari6_0(String trace) 176 Trace.parseSafari6_0(String trace)
176 : this(trace.trim().split("\n") 177 : this(trace.trim().split("\n")
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // Figure out the longest path so we know how much to pad. 241 // Figure out the longest path so we know how much to pad.
241 var longest = frames.map((frame) => frame.location.length) 242 var longest = frames.map((frame) => frame.location.length)
242 .fold(0, math.max); 243 .fold(0, math.max);
243 244
244 // Print out the stack trace nicely formatted. 245 // Print out the stack trace nicely formatted.
245 return frames.map((frame) { 246 return frames.map((frame) {
246 return '${padRight(frame.location, longest)} ${frame.member}\n'; 247 return '${padRight(frame.location, longest)} ${frame.member}\n';
247 }).join(); 248 }).join();
248 } 249 }
249 } 250 }
OLDNEW
« no previous file with comments | « no previous file | pkg/stack_trace/test/trace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698