| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 | 5 |
| 6 #include "bin/loader.h" | 6 #include "bin/loader.h" |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/dartutils.h" | 9 #include "bin/dartutils.h" |
| 10 #include "bin/extensions.h" | 10 #include "bin/extensions.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 Dart_Handle library = Dart_LookupLibrary(library_uri); | 297 Dart_Handle library = Dart_LookupLibrary(library_uri); |
| 298 ASSERT(!Dart_IsError(library)); | 298 ASSERT(!Dart_IsError(library)); |
| 299 const char* lib_uri = reinterpret_cast<const char*>(result->payload); | 299 const char* lib_uri = reinterpret_cast<const char*>(result->payload); |
| 300 if (strncmp(lib_uri, "http://", 7) == 0 || | 300 if (strncmp(lib_uri, "http://", 7) == 0 || |
| 301 strncmp(lib_uri, "https://", 8) == 0) { | 301 strncmp(lib_uri, "https://", 8) == 0) { |
| 302 loader->error_ = | 302 loader->error_ = |
| 303 Dart_NewApiError("Cannot load native extensions over http: or https:"); | 303 Dart_NewApiError("Cannot load native extensions over http: or https:"); |
| 304 return false; | 304 return false; |
| 305 } | 305 } |
| 306 const char* extension_uri = reinterpret_cast<const char*>(result->uri); | 306 const char* extension_uri = reinterpret_cast<const char*>(result->uri); |
| 307 const char* lib_path = DartUtils::RemoveScheme(lib_uri); | 307 const char* lib_path = NULL; |
| 308 if (strncmp(lib_uri, "file://", 7) == 0) { |
| 309 lib_path = DartUtils::RemoveScheme(lib_uri); |
| 310 } else { |
| 311 lib_path = lib_uri; |
| 312 } |
| 308 const char* extension_path = DartUtils::RemoveScheme(extension_uri); | 313 const char* extension_path = DartUtils::RemoveScheme(extension_uri); |
| 309 if (strchr(extension_path, '/') != NULL || | 314 if (strchr(extension_path, '/') != NULL || |
| 310 (IsWindowsHost() && strchr(extension_path, '\\') != NULL)) { | 315 (IsWindowsHost() && strchr(extension_path, '\\') != NULL)) { |
| 311 loader->error_ = DartUtils::NewError( | 316 loader->error_ = DartUtils::NewError( |
| 312 "Relative paths for dart extensions are not supported: '%s'", | 317 "Relative paths for dart extensions are not supported: '%s'", |
| 313 extension_path); | 318 extension_path); |
| 314 return false; | 319 return false; |
| 315 } | 320 } |
| 316 Dart_Handle result = Extensions::LoadExtension(lib_path, | 321 Dart_Handle result = Extensions::LoadExtension(lib_path, |
| 317 extension_path, | 322 extension_path, |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 MutexLocker ml(loader_infos_lock_); | 748 MutexLocker ml(loader_infos_lock_); |
| 744 Loader* loader = LoaderForLocked(dest_port_id); | 749 Loader* loader = LoaderForLocked(dest_port_id); |
| 745 if (loader == NULL) { | 750 if (loader == NULL) { |
| 746 return; | 751 return; |
| 747 } | 752 } |
| 748 loader->QueueMessage(message); | 753 loader->QueueMessage(message); |
| 749 } | 754 } |
| 750 | 755 |
| 751 } // namespace bin | 756 } // namespace bin |
| 752 } // namespace dart | 757 } // namespace dart |
| OLD | NEW |