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

Side by Side Diff: runtime/bin/builtin.dart

Issue 16092007: HTTP loading tests and package root support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library builtin; 5 library builtin;
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 int _httpRequestResponseCode = 0; 8 int _httpRequestResponseCode = 0;
9 String _httpRequestStatusString; 9 String _httpRequestStatusString;
10 var _httpRequestResponse; 10 var _httpRequestResponse;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 } 67 }
68 68
69 _setPackageRoot(String packageRoot) { 69 _setPackageRoot(String packageRoot) {
70 // TODO(mattsh) - refactor windows drive and path handling code 70 // TODO(mattsh) - refactor windows drive and path handling code
71 // so it can be used here if needed. 71 // so it can be used here if needed.
72 _packageRoot = packageRoot; 72 _packageRoot = packageRoot;
73 } 73 }
74 74
75 String _resolveScriptUri(String cwd, String scriptName, bool isWindows) { 75 String _resolveScriptUri(String cwd, String scriptName, bool isWindows) {
76 var scriptUri = Uri.parse(scriptName);
77 if (scriptUri.scheme == 'http') {
78 _entrypoint = scriptUri;
79 _logResolution("# Resolved script to: $_entrypoint");
80 return _entrypoint.toString();
81 }
76 _logResolution("# Current working directory: $cwd"); 82 _logResolution("# Current working directory: $cwd");
77 _logResolution("# ScriptName: $scriptName"); 83 _logResolution("# ScriptName: $scriptName");
78 if (isWindows) { 84 if (isWindows) {
79 // For Windows we need to massage the paths a bit according to 85 // For Windows we need to massage the paths a bit according to
80 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx 86 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
81 // 87 //
82 // Convert 88 // Convert
83 // C:\one\two\three 89 // C:\one\two\three
84 // to 90 // to
85 // /C:/one/two/three 91 // /C:/one/two/three
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 var wrong = 'package://$path'; 195 var wrong = 'package://$path';
190 196
191 throw "URIs using the 'package:' scheme should look like " 197 throw "URIs using the 'package:' scheme should look like "
192 "'$right', not '$wrong'."; 198 "'$right', not '$wrong'.";
193 } 199 }
194 200
195 var path; 201 var path;
196 if (_packageRoot != null) { 202 if (_packageRoot != null) {
197 path = "${_packageRoot}${uri.path}"; 203 path = "${_packageRoot}${uri.path}";
198 } else { 204 } else {
199 path = _entrypoint.resolve('packages/${uri.path}').path; 205 if (_entrypoint.scheme == 'http') {
206 path = _entrypoint.resolve('packages/${uri.path}').toString();
207 } else {
208 path = _entrypoint.resolve('packages/${uri.path}').path;
209 }
200 } 210 }
201 211
202 _logResolution("# Package: $path"); 212 _logResolution("# Package: $path");
203 return path; 213 return path;
204 } 214 }
205 215
206 String _filePathFromHttpUri(Uri uri) { 216 String _filePathFromHttpUri(Uri uri) {
207 _logResolution('# Path: $uri'); 217 _logResolution('# Path: $uri');
208 return uri.toString(); 218 return uri.toString();
209 } 219 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/dartutils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698