Use window.location.href in path under dart2js.
R=rnystrom@google.com
Review URL: https://codereview.chromium.org//19939004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/path@25304 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/lib/path.dart b/lib/path.dart
index 1d83c00..3d533e1 100644
--- a/lib/path.dart
+++ b/lib/path.dart
@@ -20,6 +20,9 @@
/// [pkg]: http://pub.dartlang.org/packages/path
library path;
+@MirrorsUsed(targets: 'dart.dom.html.window, '
+ 'dart.io.Directory.current, '
+ 'dart.io.Platform.operatingSystem')
import 'dart:mirrors';
/// An internal builder for the current OS so we can provide a straight
@@ -37,26 +40,15 @@
/// [LibraryMirror] that gives access to the `dart:io` library.
///
/// If `dart:io` is not available, this returns null.
-LibraryMirror get _io {
- try {
- return currentMirrorSystem().libraries[Uri.parse('dart:io')];
- } catch (_) {
- return null;
- }
-}
+LibraryMirror get _io => currentMirrorSystem().libraries[Uri.parse('dart:io')];
// TODO(nweiz): when issue 6490 or 6943 are fixed, make this work under dart2js.
/// If we're running in Dartium, this will return a [LibraryMirror] that gives
/// access to the `dart:html` library.
///
/// If `dart:html` is not available, this returns null.
-LibraryMirror get _html {
- try {
- return currentMirrorSystem().libraries[Uri.parse('dart:html')];
- } catch (_) {
- return null;
- }
-}
+LibraryMirror get _html =>
+ currentMirrorSystem().libraries[Uri.parse('dart:html')];
/// Gets the path to the current working directory.
///
diff --git a/test/dartium_test.dart b/test/browser_test.dart
similarity index 100%
rename from test/dartium_test.dart
rename to test/browser_test.dart
diff --git a/test/dart2js_test.dart b/test/dart2js_test.dart
deleted file mode 100644
index 997513d..0000000
--- a/test/dart2js_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:unittest/unittest.dart';
-import 'package:path/path.dart' as path;
-
-// In the future, the default root will be window.location.href, but right now
-// that's not possible.
-
-main() {
- group('new Builder()', () {
- test('uses the current working directory if root is omitted', () {
- var builder = new path.Builder();
- expect(builder.root, '.');
- });
-
- test('uses URL if style is omitted', () {
- var builder = new path.Builder();
- expect(builder.style, path.Style.url);
- });
- });
-
- test('current', () {
- expect(path.current, '.');
- });
-}