OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "native_client/src/trusted/plugin/json_manifest.h" | 9 #include "native_client/src/trusted/plugin/json_manifest.h" |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return false; | 112 return false; |
113 } | 113 } |
114 // Check for unknown dictionary members. | 114 // Check for unknown dictionary members. |
115 Json::Value::Members members = dictionary.getMemberNames(); | 115 Json::Value::Members members = dictionary.getMemberNames(); |
116 for (size_t i = 0; i < members.size(); ++i) { | 116 for (size_t i = 0; i < members.size(); ++i) { |
117 nacl::string property_name = members[i]; | 117 nacl::string property_name = members[i]; |
118 if (!FindMatchingProperty(property_name, | 118 if (!FindMatchingProperty(property_name, |
119 valid_keys, | 119 valid_keys, |
120 valid_key_count)) { | 120 valid_key_count)) { |
121 // TODO(jvoung): Should this set error_string and return false? | 121 // TODO(jvoung): Should this set error_string and return false? |
122 PLUGIN_PRINTF(("WARNING: '%s' property '%s' has unknown key '%s'.", | 122 PLUGIN_PRINTF(("WARNING: '%s' property '%s' has unknown key '%s'.\n", |
123 parent_key.c_str(), | 123 parent_key.c_str(), |
124 container_key.c_str(), property_name.c_str())); | 124 container_key.c_str(), property_name.c_str())); |
125 } | 125 } |
126 } | 126 } |
127 // Check for required members. | 127 // Check for required members. |
128 for (size_t i = 0; i < required_key_count; ++i) { | 128 for (size_t i = 0; i < required_key_count; ++i) { |
129 if (!dictionary.isMember(required_keys[i])) { | 129 if (!dictionary.isMember(required_keys[i])) { |
130 nacl::stringstream error_stream; | 130 nacl::stringstream error_stream; |
131 error_stream << parent_key << " property '" << container_key | 131 error_stream << parent_key << " property '" << container_key |
132 << "' does not have required key: '" | 132 << "' does not have required key: '" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 if (!FindMatchingProperty(property_name, | 229 if (!FindMatchingProperty(property_name, |
230 kManifestISAProperties, | 230 kManifestISAProperties, |
231 NACL_ARRAY_SIZE(kManifestISAProperties))) { | 231 NACL_ARRAY_SIZE(kManifestISAProperties))) { |
232 PLUGIN_PRINTF(("IsValidISADictionary: unrecognized ISA '%s'.\n", | 232 PLUGIN_PRINTF(("IsValidISADictionary: unrecognized ISA '%s'.\n", |
233 property_name.c_str())); | 233 property_name.c_str())); |
234 } | 234 } |
235 // Could be "arch/portable" : URLSpec, or | 235 // Could be "arch/portable" : URLSpec, or |
236 // it could be "arch/portable" : { "pnacl-translate": URLSpec } | 236 // it could be "arch/portable" : { "pnacl-translate": URLSpec } |
237 // for executables that need to be translated. | 237 // for executables that need to be translated. |
238 Json::Value property_value = dictionary[property_name]; | 238 Json::Value property_value = dictionary[property_name]; |
239 if (!IsValidPnaclTranslateSpec(property_value, property_name, | 239 if (!IsValidUrlSpec(property_value, property_name, parent_key, |
240 parent_key, error_string) && | 240 error_string) && |
241 !IsValidUrlSpec(property_value, property_name, parent_key, | 241 !IsValidPnaclTranslateSpec(property_value, property_name, |
242 error_string)) { | 242 parent_key, error_string)) { |
243 return false; | 243 return false; |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 // TODO(elijahtaylor) add ISA resolver here if we expand ISAs to include | 247 // TODO(elijahtaylor) add ISA resolver here if we expand ISAs to include |
248 // micro-architectures that can resolve to multiple valid sandboxes. | 248 // micro-architectures that can resolve to multiple valid sandboxes. |
249 bool has_isa = dictionary.isMember(sandbox_isa); | 249 bool has_isa = dictionary.isMember(sandbox_isa); |
250 bool has_portable = dictionary.isMember(kPortableKey); | 250 bool has_portable = dictionary.isMember(kPortableKey); |
251 | 251 |
252 if (!has_isa && !has_portable) { | 252 if (!has_isa && !has_portable) { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 error_info->SetReport( | 554 error_info->SetReport( |
555 ERROR_MANIFEST_RESOLVE_URL, | 555 ERROR_MANIFEST_RESOLVE_URL, |
556 nacl::string("ResolveKey: no such \"files\" entry: ") + key); | 556 nacl::string("ResolveKey: no such \"files\" entry: ") + key); |
557 return false; | 557 return false; |
558 } | 558 } |
559 return GetKeyUrl(files, rest, sandbox_isa_, this, prefer_portable_, | 559 return GetKeyUrl(files, rest, sandbox_isa_, this, prefer_portable_, |
560 full_url, cache_identity, error_info, pnacl_translate); | 560 full_url, cache_identity, error_info, pnacl_translate); |
561 } | 561 } |
562 | 562 |
563 } // namespace plugin | 563 } // namespace plugin |
OLD | NEW |