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

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

Issue 23068019: Support IE and Safari stack traces. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « pkg/stack_trace/lib/src/frame.dart ('k') | pkg/stack_trace/test/trace_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/stack_trace/lib/src/trace.dart
diff --git a/pkg/stack_trace/lib/src/trace.dart b/pkg/stack_trace/lib/src/trace.dart
index 4aea96023a73d808645b843e3a7610a66aa7ce27..46baadaa58b6fc6c8f5d2cd24738f2a236993b5d 100644
--- a/pkg/stack_trace/lib/src/trace.dart
+++ b/pkg/stack_trace/lib/src/trace.dart
@@ -82,7 +82,8 @@ class Trace implements StackTrace {
factory Trace.parse(String trace) {
try {
if (trace.isEmpty) return new Trace(<Frame>[]);
- if (trace.contains(_v8Trace)) return new Trace.parseV8(trace);
+ if (trace.startsWith("Error\n")) return new Trace.parseV8(trace);
+ // Valid Safari traces are a superset of valid Firefox traces.
if (trace.contains(_firefoxTrace)) return new Trace.parseFirefox(trace);
if (trace.contains(_friendlyTrace)) return new Trace.parseFriendly(trace);
@@ -108,11 +109,29 @@ class Trace implements StackTrace {
.skipWhile((line) => !line.startsWith(" at "))
.map((line) => new Frame.parseV8(line)));
+ /// Parses a string representation of an Internet Explorer stack trace.
+ ///
+ /// IE10+ traces look just like V8 traces. Prior to IE10, stack traces can't
+ /// be retrieved.
+ Trace.parseIE(String trace)
+ : this.parseV8(trace);
+
/// Parses a string representation of a Firefox stack trace.
Trace.parseFirefox(String trace)
: this(trace.trim().split("\n")
.map((line) => new Frame.parseFirefox(line)));
+ /// Parses a string representation of a Safari stack trace.
+ ///
+ /// Safari 6+ stack traces look just like Firefox traces, except that they
+ /// sometimes (e.g. in isolates) have a "[native code]" frame. We just ignore
+ /// this frame to make the stack format more consistent between browsers.
+ /// Prior to Safari 6, stack traces can't be retrieved.
+ Trace.parseSafari(String trace)
+ : this(trace.trim().split("\n")
+ .where((line) => line != '[native code]')
+ .map((line) => new Frame.parseFirefox(line)));
+
/// Parses this package's a string representation of a stack trace.
Trace.parseFriendly(String trace)
: this(trace.trim().split("\n")
« no previous file with comments | « pkg/stack_trace/lib/src/frame.dart ('k') | pkg/stack_trace/test/trace_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698