summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorjvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-13 01:55:19 +0000
committerjvoung@chromium.org <jvoung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-13 01:55:19 +0000
commit69d9b811fe005f12541e72d651ad863b919c50ec (patch)
tree807e71b9c80c3154c84026dd89375fbe05670b14 /ppapi
parentd5367c738b60d1c2924653057bae7174c9bd9540 (diff)
downloadchromium_src-69d9b811fe005f12541e72d651ad863b919c50ec.zip
chromium_src-69d9b811fe005f12541e72d651ad863b919c50ec.tar.gz
chromium_src-69d9b811fe005f12541e72d651ad863b919c50ec.tar.bz2
Make PNaCl load error message w/ wrong mimetype more helpful.
Actually say that the manifest looks pnacl-like, but you have a NaCl mimetype instead of a PNaCl mimetype. The SDK guys have been running into this a lot. "PNaCl-like NMF with application/x-nacl mimetype instead of x-pnacl mimetype (has pnacl-translate)." Also test what happens when you have a PNaCl manifest without "pnacl-translate". BUG=253715 TEST=*Pnacl.PnaclErrorHandling Review URL: https://chromiumcodereview.appspot.com/22908002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/native_client/src/trusted/plugin/json_manifest.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/json_manifest.cc b/ppapi/native_client/src/trusted/plugin/json_manifest.cc
index 12d3c10..0928c05 100644
--- a/ppapi/native_client/src/trusted/plugin/json_manifest.cc
+++ b/ppapi/native_client/src/trusted/plugin/json_manifest.cc
@@ -173,6 +173,15 @@ bool IsValidUrlSpec(const Json::Value& url_spec,
urlSpecPlusOptional = kPnaclUrlSpecPlusOptional;
urlSpecPlusOptionalLength = NACL_ARRAY_SIZE(kPnaclUrlSpecPlusOptional);
} else {
+ // URL specifications must not contain "pnacl-translate" keys.
+ // This prohibits NaCl clients from invoking PNaCl.
+ if (url_spec.isMember(kPnaclTranslateKey)) {
+ nacl::stringstream error_stream;
+ error_stream << "PNaCl-like NMF with application/x-nacl mimetype instead "
+ << "of x-pnacl mimetype (has " << kPnaclTranslateKey << ").";
+ *error_string = error_stream.str();
+ return false;
+ }
urlSpecPlusOptional = kManifestUrlSpecRequired;
urlSpecPlusOptionalLength = NACL_ARRAY_SIZE(kManifestUrlSpecRequired);
}
@@ -184,16 +193,6 @@ bool IsValidUrlSpec(const Json::Value& url_spec,
error_string)) {
return false;
}
- // URL specifications must not contain "pnacl-translate" keys.
- // This prohibits NaCl clients from invoking PNaCl.
- Json::Value translate = url_spec[kPnaclTranslateKey];
- if (!translate.empty()) {
- nacl::stringstream error_stream;
- error_stream << parent_key << " property '" << container_key <<
- "' has '" << kPnaclTranslateKey << "' inside URL spec.";
- *error_string = error_stream.str();
- return false;
- }
// Verify the correct types of the fields if they exist.
Json::Value url = url_spec[kUrlKey];
if (!url.isString()) {