Improve the display of data: URIs in stack traces.
R=rnystrom@google.com
Review URL: https://codereview.chromium.org//1320393003 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index defe093..dae0db6 100644
--- a/CHANGELOG.md
+++ b/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/lib/src/frame.dart b/lib/src/frame.dart
index 072983a..4077c7c 100644
--- a/lib/src/frame.dart
+++ b/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/pubspec.yaml b/pubspec.yaml
index 7274bcc..5c8b720 100644
--- a/pubspec.yaml
+++ b/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/test/frame_test.dart b/test/frame_test.dart
index 1233cbf..63035e0 100644
--- a/test/frame_test.dart
+++ b/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', () {