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

Side by Side Diff: runtime/bin/extensions.cc

Issue 2153203002: Strip the scheme off of uris passed into the native extension loader. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rmacnak review Created 4 years, 5 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
« no previous file with comments | « no previous file | runtime/bin/loader.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 #include "bin/extensions.h" 5 #include "bin/extensions.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "bin/dartutils.h" 9 #include "bin/dartutils.h"
10 #include "bin/file.h" 10 #include "bin/file.h"
11 #include "bin/platform.h" 11 #include "bin/platform.h"
12 #include "include/dart_api.h" 12 #include "include/dart_api.h"
13 #include "platform/assert.h" 13 #include "platform/assert.h"
14 #include "platform/globals.h" 14 #include "platform/globals.h"
15 15
16 namespace dart { 16 namespace dart {
17 namespace bin { 17 namespace bin {
18 18
19 Dart_Handle Extensions::LoadExtension(const char* extension_directory, 19 Dart_Handle Extensions::LoadExtension(const char* extension_directory,
20 const char* extension_name, 20 const char* extension_name,
21 Dart_Handle parent_library) { 21 Dart_Handle parent_library) {
22 if (strncmp(extension_directory, "http://", 7) == 0 ||
23 strncmp(extension_directory, "https://", 8) == 0) {
24 return Dart_NewApiError("Cannot load native extensions over http:");
25 }
26
27 // For example on Linux: directory/libfoo-arm.so 22 // For example on Linux: directory/libfoo-arm.so
28 const char* library_strings[] = { 23 const char* library_strings[] = {
29 extension_directory, // directory/ 24 extension_directory, // directory/
30 Platform::LibraryPrefix(), // lib 25 Platform::LibraryPrefix(), // lib
31 extension_name, // foo 26 extension_name, // foo
32 "-", 27 "-",
33 Platform::HostArchitecture(), // arm 28 Platform::HostArchitecture(), // arm
34 ".", 29 ".",
35 Platform::LibraryExtension(), // so 30 Platform::LibraryExtension(), // so
36 NULL, 31 NULL,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 for (int i = 0; strings[i] != NULL; i++) { 76 for (int i = 0; strings[i] != NULL; i++) {
82 index += snprintf(result + index, size - index, "%s", strings[i]); 77 index += snprintf(result + index, size - index, "%s", strings[i]);
83 } 78 }
84 ASSERT(index == size - 1); 79 ASSERT(index == size - 1);
85 ASSERT(result[size - 1] == '\0'); 80 ASSERT(result[size - 1] == '\0');
86 return result; 81 return result;
87 } 82 }
88 83
89 } // namespace bin 84 } // namespace bin
90 } // namespace dart 85 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698