Work around issue 17083 in pkg/stack_trace.

This also properly reports timer_impl.dart as being in dart:io rather
than dart:async.

R=rnystrom@google.com
BUG=

Review URL: https://codereview.chromium.org//180363003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/stack_trace@33039 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkgs/stack_trace/lib/src/frame.dart b/pkgs/stack_trace/lib/src/frame.dart
index 7b9c7b1..96a5ec5 100644
--- a/pkgs/stack_trace/lib/src/frame.dart
+++ b/pkgs/stack_trace/lib/src/frame.dart
@@ -47,6 +47,15 @@
 
 final _initialDot = new RegExp(r"^\.");
 
+/// "dart:" libraries that are incorrectly reported without a "dart:" prefix.
+///
+/// See issue 11901. All these libraries should be in "dart:io".
+final _ioLibraries = new Set.from([
+  new Uri(path: 'timer_impl.dart'),
+  new Uri(path: 'http_impl.dart'),
+  new Uri(path: 'http_parser.dart')
+]);
+
 /// A single stack frame. Each frame points to a precise location in Dart code.
 class Frame {
   /// The URI of the file in which the code is located.
@@ -130,10 +139,7 @@
     // always be found. The column is optional.
     var member = match[1].replaceAll("<anonymous closure>", "<fn>");
     var uri = Uri.parse(match[2]);
-    // Work around issue 11901.
-    if (uri == new Uri(path: 'timer_impl.dart')) {
-      uri = Uri.parse('dart:async/timer_impl.dart');
-    }
+    if (_ioLibraries.contains(uri)) uri = Uri.parse('dart:io/${uri.path}');
     var line = int.parse(match[3]);
     var column = null;
     var columnMatch = match[4];
diff --git a/pkgs/stack_trace/pubspec.yaml b/pkgs/stack_trace/pubspec.yaml
index 5a023c0..1e62ca6 100644
--- a/pkgs/stack_trace/pubspec.yaml
+++ b/pkgs/stack_trace/pubspec.yaml
@@ -1,5 +1,5 @@
 name: stack_trace
-version: 0.9.1-dev+1
+version: 0.9.2
 author: "Dart Team <misc@dartlang.org>"
 homepage: http://www.dartlang.org
 description: >
diff --git a/pkgs/stack_trace/test/frame_test.dart b/pkgs/stack_trace/test/frame_test.dart
index 482794c..b61e8bb 100644
--- a/pkgs/stack_trace/test/frame_test.dart
+++ b/pkgs/stack_trace/test/frame_test.dart
@@ -33,7 +33,25 @@
     test('parses a stack frame with timer_impl correctly', () {
       var frame = new Frame.parseVM("#1      Foo._bar "
           "(timer_impl.dart:24)");
-      expect(frame.uri, equals(Uri.parse("dart:async/timer_impl.dart")));
+      expect(frame.uri, equals(Uri.parse("dart:io/timer_impl.dart")));
+      expect(frame.line, equals(24));
+      expect(frame.column, null);
+      expect(frame.member, equals('Foo._bar'));
+    });
+
+    test('parses a stack frame with http_parser correctly', () {
+      var frame = new Frame.parseVM("#1      Foo._bar "
+          "(http_parser.dart:24)");
+      expect(frame.uri, equals(Uri.parse("dart:io/http_parser.dart")));
+      expect(frame.line, equals(24));
+      expect(frame.column, null);
+      expect(frame.member, equals('Foo._bar'));
+    });
+
+    test('parses a stack frame with http_impl correctly', () {
+      var frame = new Frame.parseVM("#1      Foo._bar "
+          "(http_impl.dart:24)");
+      expect(frame.uri, equals(Uri.parse("dart:io/http_impl.dart")));
       expect(frame.line, equals(24));
       expect(frame.column, null);
       expect(frame.member, equals('Foo._bar'));