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

Unified Diff: runtime/bin/builtin.dart

Issue 321543003: New, more validating, parser for URI. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update VM's script loading to use Uri.file instead of Uri.parse, so it properly escapes invalid cha… Created 6 years, 6 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 | « pkg/json_rpc_2/test/server/parameters_test.dart ('k') | sdk/lib/core/uri.dart » ('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 c20f7d1726c5afb990ceb024f3c7b3463d86d8f1..583533981942f28d3dd9be66118b2f8a4911a1d8 100644
--- a/runtime/bin/builtin.dart
+++ b/runtime/bin/builtin.dart
@@ -215,7 +215,7 @@ void _setWorkingDirectory(cwd) {
_workingWindowsDrivePrefix = _extractDriveLetterPrefix(cwd);
cwd = _sanitizeWindowsPath(cwd);
cwd = _enforceTrailingSlash(cwd);
Lasse Reichstein Nielsen 2014/06/13 11:53:04 Are these sanitizations still necessary when using
Anders Johnsen 2014/06/13 12:41:38 Please try without.
Søren Gjesse 2014/06/13 15:25:04 I think it is - if this is used with .resolve then
- _workingDirectoryUri = new Uri(scheme: 'file', path: cwd);
+ _workingDirectoryUri = new Uri.file(cwd);
_logResolution('# Working Directory: $cwd');
}
@@ -238,8 +238,15 @@ String _resolveScriptUri(String scriptName) {
throw 'No current working directory set.';
}
scriptName = _sanitizeWindowsPath(scriptName);
-
- var scriptUri = Uri.parse(scriptName);
+ var scriptUri;
+ if (scriptName.startsWith("file:") ||
+ scriptName.startsWith("http:") ||
+ scriptName.startsWith("https:")) {
+ scriptUri = Uri.parse(scriptName);
+ } else {
+ // Assume it's a file name.
+ scriptUri = new Uri.file(scriptName);
+ }
if (scriptUri.scheme != '') {
// Script has a scheme, assume that it is fully formed.
_entryPointScript = scriptUri;
« no previous file with comments | « pkg/json_rpc_2/test/server/parameters_test.dart ('k') | sdk/lib/core/uri.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698