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

Unified Diff: runtime/bin/extensions.cc

Issue 9694045: Change lookup path for Dart native extensions shared libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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
Index: runtime/bin/extensions.cc
diff --git a/runtime/bin/extensions.cc b/runtime/bin/extensions.cc
index afcb29fdc52a10ba9222e1c0c63e68becdcad562..e7ccabb1533b494266e0069d279678973fa32bab 100644
--- a/runtime/bin/extensions.cc
+++ b/runtime/bin/extensions.cc
@@ -10,14 +10,15 @@
#include "platform/assert.h"
#include "platform/globals.h"
#include "bin/dartutils.h"
+#include "bin/file.h"
Dart_Handle Extensions::LoadExtension(const char* extension_url,
Dart_Handle parent_library) {
ASSERT(DartUtils::IsDartExtensionSchemeURL(extension_url));
const char* library_name =
extension_url + strlen(DartUtils::kDartExtensionScheme);
- if (strchr(library_name, '/') != NULL ||
- strchr(library_name, '\\') != NULL) {
+ if (strchr(library_name, '/') != library_name &&
Mads Ager (google) 2012/03/14 10:29:47 Is this because the extension url has been fully e
Bill Hesse 2012/03/14 17:15:04 Eliminated. We now allow paths. Both absolute an
+ strchr(library_name, '\\') != library_name) {
return Dart_Error("path components not allowed in extension library name");
}
void* library_handle = LoadExtensionLibrary(library_name);
@@ -25,7 +26,14 @@ Dart_Handle Extensions::LoadExtension(const char* extension_url,
return Dart_Error("cannot find extension library");
}
- const char* strings[3] = { library_name, "_Init", NULL };
+ const char* last_path_separator =
+ strrchr(library_name, File::PathSeparator()[0]);
Mads Ager (google) 2012/03/14 10:29:47 If you are using PathSeparator here, couldn't you
Bill Hesse 2012/03/14 17:15:04 Done.
+ if (last_path_separator == NULL) {
+ return Dart_Error("cannot find path separator in resolved extension name");
+ }
+ const char* extension_name = last_path_separator + 1;
+
+ const char* strings[3] = { extension_name, "_Init", NULL };
char* init_function_name = Concatenate(strings);
typedef Dart_Handle (*InitFunctionType)(Dart_Handle import_map);
InitFunctionType fn = reinterpret_cast<InitFunctionType>(

Powered by Google App Engine
This is Rietveld 408576698