Prefer "dart:" URLs to "package:" URLs.
R=kevmoo@google.com
Review URL: https://codereview.chromium.org//1111223003
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81f21e8..3429ab7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.0.3
+
+* Prefer "dart:" URLs to "package:" URLs.
+
## 1.0.2
* Fix an off-by-one bug that was causing line numbers to be slightly off.
diff --git a/lib/source_map_stack_trace.dart b/lib/source_map_stack_trace.dart
index 41072e4..76ad41a 100644
--- a/lib/source_map_stack_trace.dart
+++ b/lib/source_map_stack_trace.dart
@@ -61,11 +61,11 @@
if (span == null) return null;
var sourceUrl = span.sourceUrl.toString();
- if (packageRoot != null && p.url.isWithin(packageRoot, sourceUrl)) {
+ if (sdkRoot != null && p.url.isWithin(sdkLib, sourceUrl)) {
+ sourceUrl = "dart:" + p.url.relative(sourceUrl, from: sdkLib);
+ } else if (packageRoot != null && p.url.isWithin(packageRoot, sourceUrl)) {
sourceUrl = "package:" +
p.url.relative(sourceUrl, from: packageRoot);
- } else if (sdkRoot != null && p.url.isWithin(sdkLib, sourceUrl)) {
- sourceUrl = "dart:" + p.url.relative(sourceUrl, from: sdkLib);
}
return new Frame(
diff --git a/pubspec.yaml b/pubspec.yaml
index a44df62..093c397 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: source_map_stack_trace
-version: 1.0.2
+version: 1.0.3
description: >
A package for applying source maps to stack traces.
author: Dart Team <misc@dartlang.org>