Version 1.18.0-dev.4.2
Cherry-pick 4bfdaa83b2c5c6f90f410e7eea4729f8f65d3440 into dev
Cherry-pick 7af8d6e5a4f981e06a29e28db180ca4badd2f0f9 into dev
diff --git a/runtime/bin/extensions.cc b/runtime/bin/extensions.cc
index f4b921f..d319ce7 100644
--- a/runtime/bin/extensions.cc
+++ b/runtime/bin/extensions.cc
@@ -19,11 +19,6 @@
Dart_Handle Extensions::LoadExtension(const char* extension_directory,
const char* extension_name,
Dart_Handle parent_library) {
- if (strncmp(extension_directory, "http://", 7) == 0 ||
- strncmp(extension_directory, "https://", 8) == 0) {
- return Dart_NewApiError("Cannot load native extensions over http:");
- }
-
// For example on Linux: directory/libfoo-arm.so
const char* library_strings[] = {
extension_directory, // directory/
diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
index 19150a7..6a99a4e 100644
--- a/runtime/bin/loader.cc
+++ b/runtime/bin/loader.cc
@@ -296,8 +296,20 @@
ASSERT(library_uri != Dart_Null());
Dart_Handle library = Dart_LookupLibrary(library_uri);
ASSERT(!Dart_IsError(library));
- const char* lib_path_str = reinterpret_cast<const char*>(result->payload);
+ const char* lib_uri = reinterpret_cast<const char*>(result->payload);
+ if (strncmp(lib_uri, "http://", 7) == 0 ||
+ strncmp(lib_uri, "https://", 8) == 0) {
+ loader->error_ =
+ Dart_NewApiError("Cannot load native extensions over http: or https:");
+ return false;
+ }
const char* extension_uri = reinterpret_cast<const char*>(result->uri);
+ const char* lib_path = NULL;
+ if (strncmp(lib_uri, "file://", 7) == 0) {
+ lib_path = DartUtils::RemoveScheme(lib_uri);
+ } else {
+ lib_path = lib_uri;
+ }
const char* extension_path = DartUtils::RemoveScheme(extension_uri);
if (strchr(extension_path, '/') != NULL ||
(IsWindowsHost() && strchr(extension_path, '\\') != NULL)) {
@@ -306,7 +318,7 @@
extension_path);
return false;
}
- Dart_Handle result = Extensions::LoadExtension(lib_path_str,
+ Dart_Handle result = Extensions::LoadExtension(lib_path,
extension_path,
library);
if (Dart_IsError(result)) {
diff --git a/tools/VERSION b/tools/VERSION
index 9a83b13..e275633 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 18
PATCH 0
PRERELEASE 4
-PRERELEASE_PATCH 1
+PRERELEASE_PATCH 2