[dart2js] remove support for reading sources from http (tech-debt)

Long ago the compiler had logic for reading sources via an http
connection. This is not a supported use case and there is no need to
keep this around anymore.

Change-Id: Ic59c154def264a52d9310133f76b153c9972899c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251701
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f9fea4f..b84f491 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -79,6 +79,11 @@
 - Remove remaining support for `.packages` files. The flag
   `--legacy-packages-file` is no longer supported.
 
+#### dart2js
+
+- **Breaking change** [49473](https://github.com/dart-lang/sdk/issues/49473):
+  dart2js no longer supports HTTP URIs as inputs.
+
 ### Core libraries
 
 #### `dart:io`
diff --git a/pkg/compiler/lib/src/source_file_provider.dart b/pkg/compiler/lib/src/source_file_provider.dart
index 8813a7f..667f25f 100644
--- a/pkg/compiler/lib/src/source_file_provider.dart
+++ b/pkg/compiler/lib/src/source_file_provider.dart
@@ -34,8 +34,6 @@
 
     if (resourceUri.isScheme('file')) {
       return _readFromFile(resourceUri, inputKind);
-    } else if (resourceUri.isScheme('http') || resourceUri.isScheme('https')) {
-      return _readFromHttp(resourceUri, inputKind);
     } else {
       throw ArgumentError("Unknown scheme in uri '$resourceUri'");
     }
@@ -125,45 +123,6 @@
     return Future.value(input);
   }
 
-  Future<api.Input<List<int>>> _readFromHttp(
-      Uri resourceUri, api.InputKind inputKind) {
-    assert(resourceUri.isScheme('http'));
-    HttpClient client = HttpClient();
-    return client
-        .getUrl(resourceUri)
-        .then((HttpClientRequest request) => request.close())
-        .then((HttpClientResponse response) {
-      if (response.statusCode != HttpStatus.ok) {
-        String msg = 'Failure getting $resourceUri: '
-            '${response.statusCode} ${response.reasonPhrase}';
-        throw msg;
-      }
-      return response.toList();
-    }).then((List<List<int>> splitContent) {
-      int totalLength = splitContent.fold(0, (int old, List list) {
-        return old + list.length;
-      });
-      Uint8List result = Uint8List(totalLength);
-      int offset = 0;
-      for (List<int> contentPart in splitContent) {
-        result.setRange(offset, offset + contentPart.length, contentPart);
-        offset += contentPart.length;
-      }
-      dartCharactersRead += totalLength;
-      api.Input<List<int>> input;
-      switch (inputKind) {
-        case api.InputKind.UTF8:
-          input = utf8SourceFiles[resourceUri] = CachingUtf8BytesSourceFile(
-              resourceUri, resourceUri.toString(), result);
-          break;
-        case api.InputKind.binary:
-          input = binarySourceFiles[resourceUri] = Binary(resourceUri, result);
-          break;
-      }
-      return input;
-    });
-  }
-
   relativizeUri(Uri uri) => fe.relativizeUri(cwd, uri, isWindows);
 
   SourceFile<List<int>> getUtf8SourceFile(Uri resourceUri) {