Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: runtime/bin/builtin.dart

Issue 2004933002: Simplify the canonicalization of dart-ext uris. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin.dart
diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart
index f0c0cdcf666adcbed7c9b14d0727df9ec4c35e7a..6b16d994551827de5ae466d623cc1eaafb690ffd 100644
--- a/runtime/bin/builtin.dart
+++ b/runtime/bin/builtin.dart
@@ -702,13 +702,7 @@ String _resolveUri(String base, String userString) {
_log('Resolving: $userString from $base');
}
var baseUri = Uri.parse(base);
- var result;
- if (userString.startsWith(_DART_EXT)) {
- var uri = userString.substring(_DART_EXT.length);
- result = '$_DART_EXT${baseUri.resolve(uri)}';
- } else {
- result = baseUri.resolve(userString).toString();
- }
+ var result = baseUri.resolve(userString).toString();
if (_traceLoading) {
_log('Resolved $userString in $base to $result');
}
@@ -831,10 +825,6 @@ String _resolveInWorkingDirectory(String fileName) {
}
-// Handling of dart-ext loading.
-// Dart native extension scheme.
-const _DART_EXT = 'dart-ext:';
-
// Returns either a file path or a URI starting with http[s]:, as a String.
String _filePathFromUri(String userUri) {
var uri = Uri.parse(userUri);
@@ -864,42 +854,19 @@ String _filePathFromUri(String userUri) {
}
-// Embedder Entrypoint:
-// When loading an extension the embedder calls this method to get the
-// different components.
-// Returns the directory part, the filename part, and the name
-// of a native extension URL as a list [directory, filename, name].
-// The directory part is either a file system path or an HTTP(S) URL.
-// The filename part is the extension name, with the platform-dependent
-// prefixes and extensions added.
-_extensionPathFromUri(String userUri) {
+// Embedder Entrypoint.
+_libraryFilePath(String libraryUri) {
if (!_setupCompleted) {
_setupHooks();
}
- if (!userUri.startsWith(_DART_EXT)) {
- throw 'Unexpected internal error: Extension URI $userUri missing dart-ext:';
- }
- userUri = userUri.substring(_DART_EXT.length);
-
- if (userUri.contains('\\')) {
- throw 'Unexpected internal error: Extension URI $userUri contains \\';
- }
-
- String name;
- String path; // Will end in '/'.
- int index = userUri.lastIndexOf('/');
+ int index = libraryUri.lastIndexOf('/');
+ var path;
if (index == -1) {
- name = userUri;
path = './';
- } else if (index == userUri.length - 1) {
- throw 'Extension name missing in $extensionUri';
} else {
- name = userUri.substring(index + 1);
- path = userUri.substring(0, index + 1);
+ path = libraryUri.substring(0, index + 1);
}
- path = _filePathFromUri(path);
-
- return [path, name];
+ return _filePathFromUri(path);
}
« no previous file with comments | « no previous file | runtime/bin/dartutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698