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

Unified Diff: lib/src/frame.dart

Issue 2739643004: Fix friendly frame parsing bugs. (Closed)
Patch Set: Fix friendly frame parsing bugs. Created 3 years, 9 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 | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/frame.dart
diff --git a/lib/src/frame.dart b/lib/src/frame.dart
index 8dde788a734919c831bcc0338bcb89c7e418ae85..8599245498168f2b8b2ccd9270a7cd1f8ca6ef32 100644
--- a/lib/src/frame.dart
+++ b/lib/src/frame.dart
@@ -52,9 +52,11 @@ final _firefoxSafariFrame = new RegExp(
r'$');
// foo/bar.dart 10:11 Foo._bar
+// foo/bar.dart 10:11 (anonymous function).dart.fn
// http://dartlang.org/foo/bar.dart Foo._bar
+// data:... 10:11 Foo._bar
final _friendlyFrame = new RegExp(
- r'^(\S+)(?: (\d+)(?::(\d+))?)?\s+([^\d]\S*)$');
+ r'^(\S+)(?: (\d+)(?::(\d+))?)?\s+([^\d].*)$');
/// A regular expression that matches asynchronous member names generated by the
/// VM.
@@ -186,7 +188,8 @@ class Frame {
// as "Anonymous function".
return parseLocation(match[2],
match[1].replaceAll("<anonymous>", "<fn>")
- .replaceAll("Anonymous function", "<fn>"));
+ .replaceAll("Anonymous function", "<fn>")
+ .replaceAll("(anonymous function)", "<fn>"));
} else {
// The second form looks like " at LOCATION", and is used for anonymous
// functions.
@@ -249,8 +252,11 @@ class Frame {
throw new FormatException(
"Couldn't parse package:stack_trace stack trace line '$frame'.");
}
-
- var uri = Uri.parse(match[1]);
+ // Fake truncated data urls generated by the friendly stack trace format
+ // cause Uri.parse to throw an exception so we have to special case them.
+ var uri = match[1] == 'data:...'
+ ? new Uri.dataFromString('')
+ : Uri.parse(match[1]);
// If there's no scheme, this is a relative URI. We should interpret it as
// relative to the current working directory.
if (uri.scheme == '') {
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698