Index: components/nacl/renderer/ppb_nacl_private_impl.cc |
diff --git a/components/nacl/renderer/ppb_nacl_private_impl.cc b/components/nacl/renderer/ppb_nacl_private_impl.cc |
index 3c84afe5d1ee4a16187fef0b715342f5b239acf4..b0f8482efea1fa62bc0e8277d55cec1c017c3449 100644 |
--- a/components/nacl/renderer/ppb_nacl_private_impl.cc |
+++ b/components/nacl/renderer/ppb_nacl_private_impl.cc |
@@ -375,7 +375,10 @@ void LaunchSelLdr(PP_Instance instance, |
int routing_id = GetRoutingID(instance); |
NexeLoadManager* load_manager = GetNexeLoadManager(instance); |
DCHECK(load_manager); |
- if (!routing_id || !load_manager) { |
+ content::PepperPluginInstance* plugin_instance = |
+ content::PepperPluginInstance::Get(instance); |
+ DCHECK(plugin_instance); |
+ if (!routing_id || !load_manager || !plugin_instance) { |
if (nexe_file_info->handle != PP_kInvalidFileHandle) { |
base::File closer(nexe_file_info->handle); |
} |
@@ -401,6 +404,26 @@ void LaunchSelLdr(PP_Instance instance, |
IPC::PlatformFileForTransit nexe_for_transit = |
IPC::InvalidPlatformFileForTransit(); |
+ |
+ std::vector<std::pair< |
+ std::string /*url*/, std::string /*key*/> > prefetched_resource_files; |
Mark Seaborn
2015/02/25 20:01:24
How about "resource_files_to_prefetch", since they
Yusuke Sato
2015/03/01 06:59:37
Done.
|
+ if (process_type == kNativeNaClProcessType) { |
+ JsonManifest* manifest = GetJsonManifest(instance); |
+ if (manifest) |
+ manifest->GetPrefetchableFiles(&prefetched_resource_files); |
+ blink::WebSecurityOrigin security_origin = |
+ plugin_instance->GetContainer()->element().document().securityOrigin(); |
+ for (size_t i = 0; i < prefetched_resource_files.size(); ++i) { |
+ const GURL gurl(prefetched_resource_files[i].first); |
+ DCHECK(gurl.SchemeIs("chrome-extension")); |
+ // IMPORTANT SECURITY CHECK: See the comment in OpenNaClResources(). |
Mark Seaborn
2015/02/25 20:01:24
OpenNaClResources() no longer exists, I think.
Yusuke Sato
2015/03/01 06:59:37
Removed the comment
|
+ if (!security_origin.canRequest(gurl)) { |
Mark Seaborn
2015/02/25 20:01:24
Duplicating the two checks that OpenNaClExecutable
Yusuke Sato
2015/03/01 06:59:37
Done.
|
+ prefetched_resource_files.clear(); |
+ break; |
+ } |
+ } |
+ } |
+ |
#if defined(OS_POSIX) |
if (nexe_file_info->handle != PP_kInvalidFileHandle) |
nexe_for_transit = base::FileDescriptor(nexe_file_info->handle, true); |
@@ -418,6 +441,7 @@ void LaunchSelLdr(PP_Instance instance, |
nexe_for_transit, |
nexe_file_info->token_lo, |
nexe_file_info->token_hi, |
+ prefetched_resource_files, |
routing_id, |
perm_bits, |
PP_ToBool(uses_nonsfi_mode), |