Source release 19.3.0
This commit is contained in:
@@ -137,6 +137,11 @@ bool TestHost::Storage::SaveToString(std::string* data) const {
|
||||
}
|
||||
|
||||
bool TestHost::Storage::read(const std::string& name, std::string* data) {
|
||||
if (wvutil::kLegacyCertificateFileName == name &&
|
||||
!g_host->baked_in_cert().empty()) {
|
||||
*data = g_host->baked_in_cert();
|
||||
return true;
|
||||
}
|
||||
StorageMap::iterator it = files_.find(name);
|
||||
bool ok = it != files_.end();
|
||||
LOGV("read file: %s: %s", name.c_str(), ok ? "ok" : "fail");
|
||||
@@ -148,12 +153,21 @@ bool TestHost::Storage::read(const std::string& name, std::string* data) {
|
||||
bool TestHost::Storage::write(const std::string& name,
|
||||
const std::string& data) {
|
||||
LOGV("write file: %s", name.c_str());
|
||||
if (wvutil::kLegacyCertificateFileName == name &&
|
||||
!g_host->baked_in_cert().empty()) {
|
||||
return false;
|
||||
}
|
||||
if (!CheckFilename(name)) return false;
|
||||
files_[name] = data;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TestHost::Storage::exists(const std::string& name) {
|
||||
if (wvutil::kLegacyCertificateFileName == name &&
|
||||
!g_host->baked_in_cert().empty()) {
|
||||
LOGV("exists? %s: always", name.c_str());
|
||||
return true;
|
||||
}
|
||||
StorageMap::iterator it = files_.find(name);
|
||||
bool ok = it != files_.end();
|
||||
LOGV("exists? %s: %s", name.c_str(), ok ? "true" : "false");
|
||||
@@ -174,6 +188,11 @@ bool TestHost::Storage::remove(const std::string& name) {
|
||||
}
|
||||
|
||||
int32_t TestHost::Storage::size(const std::string& name) {
|
||||
if (wvutil::kLegacyCertificateFileName == name &&
|
||||
!g_host->baked_in_cert().empty()) {
|
||||
LOGV("size? %s: always", name.c_str());
|
||||
return static_cast<int32_t>(g_host->baked_in_cert().size());
|
||||
}
|
||||
StorageMap::iterator it = files_.find(name);
|
||||
bool ok = (it != files_.end());
|
||||
LOGV("size? %s: %s", name.c_str(), ok ? "ok" : "fail");
|
||||
|
||||
Reference in New Issue
Block a user