| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 part of vmservice_io; | 5 part of vmservice_io; |
| 6 | 6 |
| 7 _sanitizeWindowsPath(path) { | 7 _sanitizeWindowsPath(path) { |
| 8 // For Windows we need to massage the paths a bit according to | 8 // For Windows we need to massage the paths a bit according to |
| 9 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx | 9 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx |
| 10 // | 10 // |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 | 473 |
| 474 // TODO(johnmccutchan): This and most other top level functions in this file | 474 // TODO(johnmccutchan): This and most other top level functions in this file |
| 475 // should be turned into methods on the IsolateLoaderState class. | 475 // should be turned into methods on the IsolateLoaderState class. |
| 476 _handleResourceRequest(IsolateLoaderState loaderState, | 476 _handleResourceRequest(IsolateLoaderState loaderState, |
| 477 SendPort sp, | 477 SendPort sp, |
| 478 bool traceLoading, | 478 bool traceLoading, |
| 479 int tag, | 479 int tag, |
| 480 Uri uri, | 480 Uri uri, |
| 481 Uri resolvedUri, | 481 Uri resolvedUri, |
| 482 String libraryUrl) { | 482 String libraryUrl) { |
| 483 if (resolvedUri.scheme == 'file') { | 483 if (resolvedUri.scheme == '' || resolvedUri.scheme == 'file') { |
| 484 _loadFile(sp, tag, uri, resolvedUri, libraryUrl); | 484 _loadFile(sp, tag, uri, resolvedUri, libraryUrl); |
| 485 } else if ((resolvedUri.scheme == 'http') || | 485 } else if ((resolvedUri.scheme == 'http') || |
| 486 (resolvedUri.scheme == 'https')) { | 486 (resolvedUri.scheme == 'https')) { |
| 487 _loadHttp(sp, tag, uri, resolvedUri, libraryUrl); | 487 _loadHttp(sp, tag, uri, resolvedUri, libraryUrl); |
| 488 } else if ((resolvedUri.scheme == 'data')) { | 488 } else if ((resolvedUri.scheme == 'data')) { |
| 489 _loadDataUri(sp, tag, uri, resolvedUri, libraryUrl); | 489 _loadDataUri(sp, tag, uri, resolvedUri, libraryUrl); |
| 490 } else if ((resolvedUri.scheme == 'package')) { | 490 } else if ((resolvedUri.scheme == 'package')) { |
| 491 _loadPackage(loaderState, | 491 _loadPackage(loaderState, |
| 492 sp, | 492 sp, |
| 493 traceLoading, | 493 traceLoading, |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 // This code used to exist in a second isolate and so it uses a SendPort to | 798 // This code used to exist in a second isolate and so it uses a SendPort to |
| 799 // report it's return value. This could be refactored so that it returns it's | 799 // report it's return value. This could be refactored so that it returns it's |
| 800 // value and the caller could wait on the future rather than a message on | 800 // value and the caller could wait on the future rather than a message on |
| 801 // SendPort. | 801 // SendPort. |
| 802 _handlePackagesRequest(SendPort sp, | 802 _handlePackagesRequest(SendPort sp, |
| 803 bool traceLoading, | 803 bool traceLoading, |
| 804 int tag, | 804 int tag, |
| 805 Uri resource) async { | 805 Uri resource) async { |
| 806 try { | 806 try { |
| 807 if (tag == -1) { | 807 if (tag == -1) { |
| 808 if (resource.scheme == 'file') { | 808 if (resource.scheme == '' || resource.scheme == 'file') { |
| 809 _findPackagesFile(sp, traceLoading, resource); | 809 _findPackagesFile(sp, traceLoading, resource); |
| 810 } else if ((resource.scheme == 'http') || (resource.scheme == 'https')) { | 810 } else if ((resource.scheme == 'http') || (resource.scheme == 'https')) { |
| 811 // Try to load the .packages file next to the resource. | 811 // Try to load the .packages file next to the resource. |
| 812 var packagesUri = resource.resolve(".packages"); | 812 var packagesUri = resource.resolve(".packages"); |
| 813 var exists = await _loadHttpPackagesFile(sp, traceLoading, packagesUri); | 813 var exists = await _loadHttpPackagesFile(sp, traceLoading, packagesUri); |
| 814 if (!exists) { | 814 if (!exists) { |
| 815 // If the loading of the .packages file failed for http/https based | 815 // If the loading of the .packages file failed for http/https based |
| 816 // scripts then setup the package root. | 816 // scripts then setup the package root. |
| 817 var packageRoot = resource.resolve('packages/'); | 817 var packageRoot = resource.resolve('packages/'); |
| 818 sp.send([packageRoot.toString()]); | 818 sp.send([packageRoot.toString()]); |
| 819 } | 819 } |
| 820 } else { | 820 } else { |
| 821 sp.send("Unsupported scheme used to locate .packages file: " | 821 sp.send("Unsupported scheme used to locate .packages file: " |
| 822 "'$resource'."); | 822 "'$resource'."); |
| 823 } | 823 } |
| 824 } else if (tag == -2) { | 824 } else if (tag == -2) { |
| 825 if (traceLoading) { | 825 if (traceLoading) { |
| 826 _log("Handling load of packages map: '$resource'."); | 826 _log("Handling load of packages map: '$resource'."); |
| 827 } | 827 } |
| 828 if (resource.scheme == 'file') { | 828 if (resource.scheme == '' || resource.scheme == 'file') { |
| 829 var exists = await new File.fromUri(resource).exists(); | 829 var exists = await new File.fromUri(resource).exists(); |
| 830 if (exists) { | 830 if (exists) { |
| 831 _loadPackagesFile(sp, traceLoading, resource); | 831 _loadPackagesFile(sp, traceLoading, resource); |
| 832 } else { | 832 } else { |
| 833 sp.send("Packages file '$resource' not found."); | 833 sp.send("Packages file '$resource' not found."); |
| 834 } | 834 } |
| 835 } else if ((resource.scheme == 'http') || (resource.scheme == 'https')) { | 835 } else if ((resource.scheme == 'http') || (resource.scheme == 'https')) { |
| 836 var exists = await _loadHttpPackagesFile(sp, traceLoading, resource); | 836 var exists = await _loadHttpPackagesFile(sp, traceLoading, resource); |
| 837 if (!exists) { | 837 if (!exists) { |
| 838 sp.send("Packages file '$resource' not found."); | 838 sp.send("Packages file '$resource' not found."); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 } | 987 } |
| 988 resolvedUri = null; | 988 resolvedUri = null; |
| 989 } | 989 } |
| 990 sp.send(resolvedUri); | 990 sp.send(resolvedUri); |
| 991 }); | 991 }); |
| 992 break; | 992 break; |
| 993 default: | 993 default: |
| 994 _log('Unknown loader request tag=$tag from $isolateId'); | 994 _log('Unknown loader request tag=$tag from $isolateId'); |
| 995 } | 995 } |
| 996 } | 996 } |
| OLD | NEW |