| Index: pkg/compiler/lib/src/util/uri_extras.dart
|
| diff --git a/pkg/compiler/lib/src/util/uri_extras.dart b/pkg/compiler/lib/src/util/uri_extras.dart
|
| index aa8cdcf7f129271ecbf3c01f5a395248435cc56c..65a4ed2516112ac27787c9719d5cc45e73642d4c 100644
|
| --- a/pkg/compiler/lib/src/util/uri_extras.dart
|
| +++ b/pkg/compiler/lib/src/util/uri_extras.dart
|
| @@ -7,18 +7,16 @@ library uri_extras;
|
| import 'dart:math';
|
|
|
| String relativize(Uri base, Uri uri, bool isWindows) {
|
| - bool equalsNCS(String a, String b) {
|
| - return a.toLowerCase() == b.toLowerCase();
|
| + if (!base.path.startsWith('/')) {
|
| + // Also throw an exception if [base] or base.path is null.
|
| + throw new ArgumentError('Expected absolute path: ${base.path}');
|
| }
|
| -
|
| - if (!equalsNCS(base.scheme, uri.scheme) ||
|
| - equalsNCS(base.scheme, 'dart') ||
|
| - equalsNCS(base.scheme, 'package')) {
|
| - return uri.toString();
|
| + if (!uri.path.startsWith('/')) {
|
| + // Also throw an exception if [uri] or uri.path is null.
|
| + throw new ArgumentError('Expected absolute path: ${uri.path}');
|
| }
|
| -
|
| - if (!equalsNCS(base.scheme, 'file')) {
|
| - isWindows = false;
|
| + bool equalsNCS(String a, String b) {
|
| + return a.toLowerCase() == b.toLowerCase();
|
| }
|
|
|
| String normalize(String path) {
|
| @@ -29,7 +27,9 @@ String relativize(Uri base, Uri uri, bool isWindows) {
|
| }
|
| }
|
|
|
| - if (base.userInfo == uri.userInfo &&
|
| + if (equalsNCS(base.scheme, 'file') &&
|
| + equalsNCS(base.scheme, uri.scheme) &&
|
| + base.userInfo == uri.userInfo &&
|
| equalsNCS(base.host, uri.host) &&
|
| base.port == uri.port &&
|
| uri.query == "" && uri.fragment == "") {
|
| @@ -37,11 +37,6 @@ String relativize(Uri base, Uri uri, bool isWindows) {
|
| return uri.path.substring(base.path.lastIndexOf('/') + 1);
|
| }
|
|
|
| - if (!base.path.startsWith('/') ||
|
| - !uri.path.startsWith('/')) {
|
| - return uri.toString();
|
| - }
|
| -
|
| List<String> uriParts = uri.path.split('/');
|
| List<String> baseParts = base.path.split('/');
|
| int common = 0;
|
|
|