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

Unified Diff: pkg/stack_trace/lib/src/frame.dart

Issue 48273005: Support Safari 6.1's new stack trace format in pkg/stack_trace. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/stack_trace/lib/src/trace.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/stack_trace/lib/src/frame.dart
diff --git a/pkg/stack_trace/lib/src/frame.dart b/pkg/stack_trace/lib/src/frame.dart
index 0b4f5771b7f825d56fd5a604b3d9c673b9d67545..b15f65140cbf90035fbdfd137c345b3248733562 100644
--- a/pkg/stack_trace/lib/src/frame.dart
+++ b/pkg/stack_trace/lib/src/frame.dart
@@ -19,6 +19,10 @@ final _v8Frame = new RegExp(
r'^\s*at (?:([^\s].*?)(?: \[as [^\]]+\])? '
r'\((.+):(\d+):(\d+)\)|(.+):(\d+):(\d+))$');
+/// foo$bar$0@http://pub.dartlang.org/stuff.dart.js:560:28
+/// http://pub.dartlang.org/stuff.dart.js:560:28
+final _safariFrame = new RegExp(r"^(?:([0-9A-Za-z_$]*)@)?(.*):(\d*):(\d*)$");
+
// .VW.call$0@http://pub.dartlang.org/stuff.dart.js:560
// .VW.call$0("arg")@http://pub.dartlang.org/stuff.dart.js:560
// .VW.call$0/name<@http://pub.dartlang.org/stuff.dart.js:560
@@ -169,11 +173,27 @@ class Frame {
return new Frame(uri, int.parse(match[4]), null, member);
}
- /// Parses a string representation of a Safari stack frame.
+ /// Parses a string representation of a Safari 6.0 stack frame.
///
- /// Safari 6+ frames look just like Firefox frames. Prior to Safari 6, stack
- /// traces can't be retrieved.
- factory Frame.parseSafari(String frame) => new Frame.parseFirefox(frame);
+ /// Safari 6.0 frames look just like Firefox frames. Prior to Safari 6.0,
+ /// stack traces can't be retrieved.
+ factory Frame.parseSafari6_0(String frame) => new Frame.parseFirefox(frame);
+
+ /// Parses a string representation of a Safari 6.1+ stack frame.
+ factory Frame.parseSafari6_1(String frame) {
+ var match = _safariFrame.firstMatch(frame);
+ if (match == null) {
+ throw new FormatException(
+ "Couldn't parse Safari stack trace line '$frame'.");
+ }
+
+ var uri = Uri.parse(match[2]);
+ var member = match[1];
+ if (member == null) member = '<fn>';
+ var line = match[3] == '' ? null : int.parse(match[3]);
+ var column = match[4] == '' ? null : int.parse(match[4]);
+ return new Frame(uri, line, column, member);
+ }
/// Parses this package's string representation of a stack frame.
factory Frame.parseFriendly(String frame) {
« no previous file with comments | « no previous file | pkg/stack_trace/lib/src/trace.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698