Improve the display of data: URIs in stack traces. R=rnystrom@google.com Review URL: https://codereview.chromium.org//1320393003 .
diff --git a/pkgs/stack_trace/CHANGELOG.md b/pkgs/stack_trace/CHANGELOG.md index defe093..dae0db6 100644 --- a/pkgs/stack_trace/CHANGELOG.md +++ b/pkgs/stack_trace/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 1.4.2 + +* Improve the display of `data:` URIs in stack traces. + ## 1.4.1 * Fix a crashing bug in `UnparsedFrame.toString()`.
diff --git a/pkgs/stack_trace/lib/src/frame.dart b/pkgs/stack_trace/lib/src/frame.dart index 072983a..4077c7c 100644 --- a/pkgs/stack_trace/lib/src/frame.dart +++ b/pkgs/stack_trace/lib/src/frame.dart
@@ -95,8 +95,11 @@ /// comes from. /// /// This will usually be the string form of [uri], but a relative URI will be - /// used if possible. - String get library => path.prettyUri(uri); + /// used if possible. Data URIs will be truncated. + String get library { + if (uri.scheme == 'data') return "data:..."; + return path.prettyUri(uri); + } /// Returns the name of the package this stack frame comes from, or `null` if /// this stack frame doesn't come from a `package:` URL.
diff --git a/pkgs/stack_trace/pubspec.yaml b/pkgs/stack_trace/pubspec.yaml index 7274bcc..5c8b720 100644 --- a/pkgs/stack_trace/pubspec.yaml +++ b/pkgs/stack_trace/pubspec.yaml
@@ -7,7 +7,7 @@ # # When the major version is upgraded, you *must* update that version constraint # in pub to stay in sync with this. -version: 1.4.1 +version: 1.4.2 author: "Dart Team <misc@dartlang.org>" homepage: http://github.com/dart-lang/stack_trace description: >
diff --git a/pkgs/stack_trace/test/frame_test.dart b/pkgs/stack_trace/test/frame_test.dart index 1233cbf..63035e0 100644 --- a/pkgs/stack_trace/test/frame_test.dart +++ b/pkgs/stack_trace/test/frame_test.dart
@@ -503,6 +503,12 @@ expect(new Frame.parseVM('#0 Foo (foo/bar.dart:0:0)').library, equals(path.join('foo', 'bar.dart'))); }); + + test('truncates data: URIs', () { + var frame = new Frame.parseVM( + '#0 Foo (data:application/dart;charset=utf-8,blah:0:0)'); + expect(frame.library, equals('data:...')); + }); }); group('.location', () {