diff options
author | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 19:49:12 +0000 |
---|---|---|
committer | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 19:49:12 +0000 |
commit | 492fe5d6c0c5bd75934d5d5453d9799b992291b9 (patch) | |
tree | e9ee0e610892993bda21fb0a82b139edc19d7aba /ppapi/native_client | |
parent | c279bff31d1c989b13adffad9e82a64bace4945a (diff) | |
download | chromium_src-492fe5d6c0c5bd75934d5d5453d9799b992291b9.zip chromium_src-492fe5d6c0c5bd75934d5d5453d9799b992291b9.tar.gz chromium_src-492fe5d6c0c5bd75934d5d5453d9799b992291b9.tar.bz2 |
Resolve manifest file resource URL relative to the manifest file's URL.
BUG= http://code.google.com/p/nativeclient/issues/detail?id=2225
TEST=chrome_browser_tests
Review URL: http://codereview.chromium.org/7792063
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99230 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/manifest.cc | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/manifest.cc b/ppapi/native_client/src/trusted/plugin/manifest.cc index ca452f8..895889f 100644 --- a/ppapi/native_client/src/trusted/plugin/manifest.cc +++ b/ppapi/native_client/src/trusted/plugin/manifest.cc @@ -198,25 +198,30 @@ bool GetKeyUrl(const Json::Value& dictionary, const nacl::string& key, const nacl::string& sandbox_isa, nacl::string* full_url, - nacl::string* error_string, - bool* is_portable) { - CHECK(full_url != NULL && error_string != NULL); + ErrorInfo* error_info, + bool* is_portable, + const Manifest* manifest) { + CHECK(full_url != NULL && error_info != NULL); + *full_url = ""; if (!dictionary.isMember(key)) { - *error_string = "file key not found in manifest"; + error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, + "file key not found in manifest"); return false; } const Json::Value& isa_dict = dictionary[key]; if (isa_dict.isMember(sandbox_isa)) { - *full_url = isa_dict[sandbox_isa][kUrlKey].asString(); + nacl::string relative_url = isa_dict[sandbox_isa][kUrlKey].asString(); *is_portable = false; - return true; + return manifest->ResolveURL(relative_url, full_url, error_info); } if (isa_dict.isMember(kPortableKey)) { - *full_url = isa_dict[kPortableKey][kUrlKey].asString(); + nacl::string relative_url = isa_dict[kPortableKey][kUrlKey].asString(); *is_portable = true; - return true; + return manifest->ResolveURL(relative_url, full_url, error_info); } - *error_string = "neither ISA-specific nor portable representations exist"; + error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, + "neither ISA-specific nor portable representations" + " exist"); return false; } @@ -394,13 +399,8 @@ bool Manifest::ResolveKey(const nacl::string& key, *full_url = ""; if (key == kProgramKey) { - nacl::string error_string; - if (!GetKeyUrl(dictionary_, key, sandbox_isa_, - full_url, &error_string, is_portable)) { - error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, error_string); - return false; - } - return true; + return GetKeyUrl(dictionary_, key, sandbox_isa_, + full_url, error_info, is_portable, this); } nacl::string::const_iterator p = find(key.begin(), key.end(), '/'); if (p == key.end()) { @@ -430,14 +430,8 @@ bool Manifest::ResolveKey(const nacl::string& key, *is_portable = false; return false; } - nacl::string error_string; - if (!GetKeyUrl(files, rest, sandbox_isa_, - full_url, &error_string, is_portable)) { - error_info->SetReport(ERROR_MANIFEST_RESOLVE_URL, error_string); - *full_url = ""; - return false; - } - return true; + return GetKeyUrl(files, rest, sandbox_isa_, + full_url, error_info, is_portable, this); } // TODO(jvoung): We won't need these if we figure out how to install llc and ld. |