summaryrefslogtreecommitdiffstats
path: root/webkit/appcache
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 01:26:10 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 01:26:10 +0000
commit4f32303e4491c3b2358825e0b26f8c5db3b28b33 (patch)
treeeeb15549ae8540ddc6e1be0a5400247d5f771844 /webkit/appcache
parente07dfdab975039ea0719e8dc7e7f5faaf0887a91 (diff)
downloadchromium_src-4f32303e4491c3b2358825e0b26f8c5db3b28b33.zip
chromium_src-4f32303e4491c3b2358825e0b26f8c5db3b28b33.tar.gz
chromium_src-4f32303e4491c3b2358825e0b26f8c5db3b28b33.tar.bz2
Undo in memory changes made by an update job if the commit to disk fails. Provide a more clear error message when the commit fails due to exceeding the quota.
TEST=MasterEntryFailStoreNewestCacheTest BUG=50985 Review URL: http://codereview.chromium.org/2836075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r--webkit/appcache/appcache.cc9
-rw-r--r--webkit/appcache/appcache.h3
-rw-r--r--webkit/appcache/appcache_storage.h3
-rw-r--r--webkit/appcache/appcache_storage_impl.cc23
-rw-r--r--webkit/appcache/appcache_storage_impl_unittest.cc3
-rw-r--r--webkit/appcache/appcache_unittest.cc48
-rw-r--r--webkit/appcache/appcache_update_job.cc26
-rw-r--r--webkit/appcache/appcache_update_job.h6
-rw-r--r--webkit/appcache/appcache_update_job_unittest.cc79
-rw-r--r--webkit/appcache/mock_appcache_storage.cc8
-rw-r--r--webkit/appcache/mock_appcache_storage_unittest.cc3
11 files changed, 172 insertions, 39 deletions
diff --git a/webkit/appcache/appcache.cc b/webkit/appcache/appcache.cc
index 4bc7294..de25b15 100644
--- a/webkit/appcache/appcache.cc
+++ b/webkit/appcache/appcache.cc
@@ -43,6 +43,7 @@ void AppCache::UnassociateHost(AppCacheHost* host) {
void AppCache::AddEntry(const GURL& url, const AppCacheEntry& entry) {
DCHECK(entries_.find(url) == entries_.end());
entries_.insert(EntryMap::value_type(url, entry));
+ cache_size_ += entry.response_size();
}
bool AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) {
@@ -57,6 +58,13 @@ bool AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) {
return ret.second;
}
+void AppCache::RemoveEntry(const GURL& url) {
+ EntryMap::iterator found = entries_.find(url);
+ DCHECK(found != entries_.end());
+ cache_size_ -= found->second.response_size();
+ entries_.erase(found);
+}
+
AppCacheEntry* AppCache::GetEntry(const GURL& url) {
EntryMap::iterator it = entries_.find(url);
return (it != entries_.end()) ? &(it->second) : NULL;
@@ -95,6 +103,7 @@ void AppCache::InitializeWithDatabaseRecords(
AddEntry(entry.url, AppCacheEntry(entry.flags, entry.response_id,
entry.response_size));
}
+ DCHECK(cache_size_ == cache_record.cache_size);
for (size_t i = 0; i < fallbacks.size(); ++i) {
const AppCacheDatabase::FallbackNameSpaceRecord& fallback = fallbacks.at(i);
diff --git a/webkit/appcache/appcache.h b/webkit/appcache/appcache.h
index a61269f..c54eb38 100644
--- a/webkit/appcache/appcache.h
+++ b/webkit/appcache/appcache.h
@@ -51,6 +51,9 @@ class AppCache : public base::RefCounted<AppCache> {
// is added, false if the flags are merged into an existing entry.
bool AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry);
+ // Removes an entry from the EntryMap, the URL must be in the set.
+ void RemoveEntry(const GURL& url);
+
// Do not store the returned object as it could be deleted anytime.
AppCacheEntry* GetEntry(const GURL& url);
diff --git a/webkit/appcache/appcache_storage.h b/webkit/appcache/appcache_storage.h
index ae214dc..9b6596c 100644
--- a/webkit/appcache/appcache_storage.h
+++ b/webkit/appcache/appcache_storage.h
@@ -48,7 +48,8 @@ class AppCacheStorage {
// If successfully stored 'success' will be true.
virtual void OnGroupAndNewestCacheStored(
- AppCacheGroup* group, AppCache* newest_cache, bool success) {}
+ AppCacheGroup* group, AppCache* newest_cache, bool success,
+ bool would_exceed_quota) {}
// If the operation fails, success will be false.
virtual void OnGroupMadeObsolete(AppCacheGroup* group, bool success) {}
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc
index 3f9ba1a..c715863 100644
--- a/webkit/appcache/appcache_storage_impl.cc
+++ b/webkit/appcache/appcache_storage_impl.cc
@@ -401,13 +401,14 @@ class AppCacheStorageImpl::StoreGroupAndCacheTask : public StoreOrLoadTask {
scoped_refptr<AppCacheGroup> group_;
scoped_refptr<AppCache> cache_;
bool success_;
+ bool would_exceed_quota_;
std::vector<int64> newly_deletable_response_ids_;
};
AppCacheStorageImpl::StoreGroupAndCacheTask::StoreGroupAndCacheTask(
AppCacheStorageImpl* storage, AppCacheGroup* group, AppCache* newest_cache)
: StoreOrLoadTask(storage), group_(group), cache_(newest_cache),
- success_(false) {
+ success_(false), would_exceed_quota_(false) {
group_record_.group_id = group->group_id();
group_record_.manifest_url = group->manifest_url();
group_record_.origin = group_record_.manifest_url.GetOrigin();
@@ -479,10 +480,19 @@ void AppCacheStorageImpl::StoreGroupAndCacheTask::Run() {
database_->InsertCache(&cache_record_) &&
database_->InsertEntryRecords(entry_records_) &&
database_->InsertFallbackNameSpaceRecords(fallback_namespace_records_)&&
- database_->InsertOnlineWhiteListRecords(online_whitelist_records_) &&
- (database_->GetOriginUsage(group_record_.origin) <=
- database_->GetOriginQuota(group_record_.origin)) &&
- transaction.Commit();
+ database_->InsertOnlineWhiteListRecords(online_whitelist_records_);
+
+ if (!success_)
+ return;
+
+ if (database_->GetOriginUsage(group_record_.origin) >
+ database_->GetOriginQuota(group_record_.origin)) {
+ would_exceed_quota_ = true;
+ success_ = false;
+ return;
+ }
+
+ success_ = transaction.Commit();
}
void AppCacheStorageImpl::StoreGroupAndCacheTask::RunCompleted() {
@@ -496,7 +506,8 @@ void AppCacheStorageImpl::StoreGroupAndCacheTask::RunCompleted() {
group_->AddNewlyDeletableResponseIds(&newly_deletable_response_ids_);
}
FOR_EACH_DELEGATE(delegates_,
- OnGroupAndNewestCacheStored(group_, cache_, success_));
+ OnGroupAndNewestCacheStored(group_, cache_, success_,
+ would_exceed_quota_));
group_ = NULL;
cache_ = NULL;
}
diff --git a/webkit/appcache/appcache_storage_impl_unittest.cc b/webkit/appcache/appcache_storage_impl_unittest.cc
index fa3c367..8367cf8 100644
--- a/webkit/appcache/appcache_storage_impl_unittest.cc
+++ b/webkit/appcache/appcache_storage_impl_unittest.cc
@@ -92,7 +92,8 @@ class AppCacheStorageImplTest : public testing::Test {
}
void OnGroupAndNewestCacheStored(
- AppCacheGroup* group, AppCache* newest_cache, bool success) {
+ AppCacheGroup* group, AppCache* newest_cache, bool success,
+ bool would_exceed_quota) {
stored_group_ = group;
stored_group_success_ = success;
test_->ScheduleNextTask();
diff --git a/webkit/appcache/appcache_unittest.cc b/webkit/appcache/appcache_unittest.cc
index 6177d13..8fcde53 100644
--- a/webkit/appcache/appcache_unittest.cc
+++ b/webkit/appcache/appcache_unittest.cc
@@ -32,26 +32,48 @@ TEST(AppCacheTest, CleanupUnusedCache) {
host2.AssociateCache(NULL);
}
-TEST(AppCacheTest, AddModifyEntry) {
+TEST(AppCacheTest, AddModifyRemoveEntry) {
MockAppCacheService service;
scoped_refptr<AppCache> cache = new AppCache(&service, 111);
- const GURL kUrl1("http://foo.com");
- AppCacheEntry entry1(AppCacheEntry::MASTER);
- cache->AddEntry(kUrl1, entry1);
- EXPECT_EQ(entry1.types(), cache->GetEntry(kUrl1)->types());
-
- const GURL kUrl2("http://bar.com");
- AppCacheEntry entry2(AppCacheEntry::FALLBACK);
- EXPECT_TRUE(cache->AddOrModifyEntry(kUrl2, entry2));
- EXPECT_EQ(entry2.types(), cache->GetEntry(kUrl2)->types());
+ EXPECT_TRUE(cache->entries().empty());
+ EXPECT_EQ(0L, cache->cache_size());
+
+ const GURL kFooUrl("http://foo.com");
+ const int64 kFooResponseId = 1;
+ const int64 kFooSize = 100;
+ AppCacheEntry entry1(AppCacheEntry::MASTER, kFooResponseId, kFooSize);
+ cache->AddEntry(kFooUrl, entry1);
+ EXPECT_EQ(entry1.types(), cache->GetEntry(kFooUrl)->types());
+ EXPECT_EQ(1UL, cache->entries().size());
+ EXPECT_EQ(kFooSize, cache->cache_size());
+
+ const GURL kBarUrl("http://bar.com");
+ const int64 kBarResponseId = 2;
+ const int64 kBarSize = 200;
+ AppCacheEntry entry2(AppCacheEntry::FALLBACK, kBarResponseId, kBarSize);
+ EXPECT_TRUE(cache->AddOrModifyEntry(kBarUrl, entry2));
+ EXPECT_EQ(entry2.types(), cache->GetEntry(kBarUrl)->types());
+ EXPECT_EQ(2UL, cache->entries().size());
+ EXPECT_EQ(kFooSize + kBarSize, cache->cache_size());
// Expected to return false when an existing entry is modified.
AppCacheEntry entry3(AppCacheEntry::EXPLICIT);
- EXPECT_FALSE(cache->AddOrModifyEntry(kUrl1, entry3));
+ EXPECT_FALSE(cache->AddOrModifyEntry(kFooUrl, entry3));
EXPECT_EQ((AppCacheEntry::MASTER | AppCacheEntry::EXPLICIT),
- cache->GetEntry(kUrl1)->types());
- EXPECT_EQ(entry2.types(), cache->GetEntry(kUrl2)->types()); // unchanged
+ cache->GetEntry(kFooUrl)->types());
+ // Only the type should be modified.
+ EXPECT_EQ(kFooResponseId, cache->GetEntry(kFooUrl)->response_id());
+ EXPECT_EQ(kFooSize, cache->GetEntry(kFooUrl)->response_size());
+ EXPECT_EQ(kFooSize + kBarSize, cache->cache_size());
+
+ EXPECT_EQ(entry2.types(), cache->GetEntry(kBarUrl)->types()); // unchanged
+
+ cache->RemoveEntry(kBarUrl);
+ EXPECT_EQ(kFooSize, cache->cache_size());
+ cache->RemoveEntry(kFooUrl);
+ EXPECT_EQ(0L, cache->cache_size());
+ EXPECT_TRUE(cache->entries().empty());
}
TEST(AppCacheTest, InitializeWithManifest) {
diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc
index 3cf5964..f22b23e 100644
--- a/webkit/appcache/appcache_update_job.cc
+++ b/webkit/appcache/appcache_update_job.cc
@@ -698,7 +698,9 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted(URLRequest* request) {
AppCacheEntry master_entry(AppCacheEntry::MASTER,
info->response_writer_->response_id(),
info->response_writer_->amount_written());
- if (!cache->AddOrModifyEntry(url, master_entry))
+ if (cache->AddOrModifyEntry(url, master_entry))
+ added_master_entries_.push_back(url);
+ else
duplicate_response_ids_.push_back(master_entry.response_id());
// In no-update case, associate host with the newest cache.
@@ -820,7 +822,8 @@ void AppCacheUpdateJob::StoreGroupAndCache() {
void AppCacheUpdateJob::OnGroupAndNewestCacheStored(AppCacheGroup* group,
AppCache* newest_cache,
- bool success) {
+ bool success,
+ bool would_exceed_quota) {
DCHECK(stored_state_ == STORING);
if (success) {
stored_state_ = STORED;
@@ -831,7 +834,10 @@ void AppCacheUpdateJob::OnGroupAndNewestCacheStored(AppCacheGroup* group,
if (newest_cache != group->newest_complete_cache())
inprogress_cache_ = newest_cache;
- HandleCacheFailure("Failed to commit new cache to storage");
+ std::string message("Failed to commit new cache to storage");
+ if (would_exceed_quota)
+ message.append(", would exceed quota");
+ HandleCacheFailure(message);
}
}
@@ -1028,6 +1034,10 @@ void AppCacheUpdateJob::CancelAllUrlFetches() {
}
bool AppCacheUpdateJob::ShouldSkipUrlFetch(const AppCacheEntry& entry) {
+ // 6.6.4 Step 17
+ // If the resource URL being processed was flagged as neither an
+ // "explicit entry" nor or a "fallback entry", then the user agent
+ // may skip this URL.
if (entry.IsExplicit() || entry.IsFallback()) {
return false;
}
@@ -1213,7 +1223,6 @@ void AppCacheUpdateJob::OnResponseInfoLoaded(
http_info->response_time,
base::Time::Now()) ||
http_info->headers->EnumerateHeader(&iter, name, &value)) {
- // TODO(michaeln): Make a conditional request when we can in this case.
LoadFromNewestCacheFailed(url, response_info);
} else {
DCHECK(group_->newest_complete_cache());
@@ -1355,8 +1364,15 @@ void AppCacheUpdateJob::ClearPendingMasterEntries() {
void AppCacheUpdateJob::DiscardInprogressCache() {
service_->storage()->DoomResponses(manifest_url_, stored_response_ids_);
- if (!inprogress_cache_)
+ if (!inprogress_cache_) {
+ // We have to undo the changes we made, if any, to the existing cache.
+ for (std::vector<GURL>::iterator iter = added_master_entries_.begin();
+ iter != added_master_entries_.end(); ++iter) {
+ DCHECK(group_->newest_complete_cache());
+ group_->newest_complete_cache()->RemoveEntry(*iter);
+ }
return;
+ }
AppCache::AppCacheHosts& hosts = inprogress_cache_->associated_hosts();
while (!hosts.empty())
diff --git a/webkit/appcache/appcache_update_job.h b/webkit/appcache/appcache_update_job.h
index ff6452c..d4a7d40 100644
--- a/webkit/appcache/appcache_update_job.h
+++ b/webkit/appcache/appcache_update_job.h
@@ -104,7 +104,7 @@ class AppCacheUpdateJob : public URLRequest::Delegate,
void OnResponseInfoLoaded(AppCacheResponseInfo* response_info,
int64 response_id);
void OnGroupAndNewestCacheStored(AppCacheGroup* group, AppCache* newest_cache,
- bool success);
+ bool success, bool would_exceed_quota);
void OnGroupMadeObsolete(AppCacheGroup* group, bool success);
// Methods for AppCacheHost::Observer.
@@ -263,6 +263,10 @@ class AppCacheUpdateJob : public URLRequest::Delegate,
std::string loaded_manifest_data_;
scoped_ptr<AppCacheResponseReader> manifest_response_reader_;
+ // New master entries added to the cache by this job, used to cleanup
+ // in error conditions.
+ std::vector<GURL> added_master_entries_;
+
// Response ids stored by this update job, used to cleanup in
// error conditions.
std::vector<int64> stored_response_ids_;
diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc
index 46dce34..693d8f6 100644
--- a/webkit/appcache/appcache_update_job_unittest.cc
+++ b/webkit/appcache/appcache_update_job_unittest.cc
@@ -193,6 +193,7 @@ class MockFrontend : public AppCacheFrontend {
virtual void OnErrorEventRaised(const std::vector<int>& host_ids,
const std::string& message) {
+ error_message_ = message;
OnEventRaised(host_ids, ERROR_EVENT);
}
@@ -266,9 +267,11 @@ class MockFrontend : public AppCacheFrontend {
typedef std::pair<HostIds, EventID> RaisedEvent;
typedef std::vector<RaisedEvent> RaisedEvents;
RaisedEvents raised_events_;
+ std::string error_message_;
// Set the expected events if verification needs to happen asynchronously.
RaisedEvents expected_events_;
+ std::string expected_error_message_;
bool ignore_progress_events_;
@@ -534,7 +537,7 @@ class AppCacheUpdateJobTest : public testing::Test,
expect_newest_cache_(NULL),
expect_non_null_update_time_(false),
tested_manifest_(NONE),
- tested_manifest1_path_override_(NULL),
+ tested_manifest_path_override_(NULL),
registered_factory_(false),
old_factory_(NULL) {
}
@@ -1402,11 +1405,11 @@ class AppCacheUpdateJobTest : public testing::Test,
void UpgradeFailMasterUrlFetchTest() {
ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
- tested_manifest1_path_override_ = "files/manifest1-with-notmodified";
+ tested_manifest_path_override_ = "files/manifest1-with-notmodified";
MakeService();
const GURL kManifestUrl =
- MockHttpServer::GetMockUrl(tested_manifest1_path_override_);
+ MockHttpServer::GetMockUrl(tested_manifest_path_override_);
group_ = new AppCacheGroup(
service_.get(), kManifestUrl,
service_->storage()->NewGroupId());
@@ -1800,6 +1803,55 @@ class AppCacheUpdateJobTest : public testing::Test,
WaitForUpdateToFinish();
}
+ void MasterEntryFailStoreNewestCacheTest() {
+ ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
+
+ MakeService();
+ MockAppCacheStorage* storage =
+ reinterpret_cast<MockAppCacheStorage*>(service_->storage());
+ storage->SimulateStoreGroupAndNewestCacheFailure();
+
+ const GURL kManifestUrl = MockHttpServer::GetMockUrl("files/notmodified");
+ const int64 kManifestResponseId = 11;
+
+ // Seed the response_info working set with canned data for
+ // files/servererror and for files/notmodified to test that the
+ // existing entries for those resource are reused by the update job.
+ const char kData[] =
+ "HTTP/1.1 200 OK\0"
+ "Content-type: text/cache-manifest\0"
+ "Last-Modified: Sat, 29 Oct 1994 19:43:31 GMT\0"
+ "\0";
+ const std::string kRawHeaders(kData, arraysize(kData));
+ MakeAppCacheResponseInfo(kManifestUrl, kManifestResponseId, kRawHeaders);
+
+ group_ = new AppCacheGroup(
+ service_.get(), kManifestUrl,
+ service_->storage()->NewGroupId());
+ scoped_refptr<AppCache> cache =
+ MakeCacheForGroup(service_->storage()->NewCacheId(),
+ kManifestResponseId);
+
+ MockFrontend* frontend = MakeMockFrontend();
+ AppCacheHost* host = MakeHost(1, frontend);
+ host->SelectCache(MockHttpServer::GetMockUrl("files/empty1"),
+ kNoCacheId, kManifestUrl);
+
+ // Set up checks for when update job finishes.
+ do_checks_after_update_finished_ = true;
+ tested_manifest_ = EMPTY_MANIFEST;
+ tested_manifest_path_override_ = "files/notmodified";
+ expect_group_obsolete_ = false;
+ expect_group_has_cache_ = true;
+ expect_newest_cache_ = cache; // unchanged
+ MockFrontend::HostIds ids1(1, host->host_id());
+ frontend->AddExpectedEvent(ids1, ERROR_EVENT);
+ frontend->expected_error_message_ =
+ "Failed to commit new cache to storage";
+
+ WaitForUpdateToFinish();
+ }
+
void FailMakeGroupObsoleteTest() {
ASSERT_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type());
@@ -2937,6 +2989,11 @@ class AppCacheUpdateJobTest : public testing::Test,
actual_ids.end());
}
}
+
+ if (!frontend->expected_error_message_.empty()) {
+ EXPECT_EQ(frontend->expected_error_message_,
+ frontend->error_message_);
+ }
}
// Verify expected cache contents last as some checks are asserts
@@ -2973,8 +3030,8 @@ class AppCacheUpdateJobTest : public testing::Test,
void VerifyManifest1(AppCache* cache) {
size_t expected = 3 + expect_extra_entries_.size();
EXPECT_EQ(expected, cache->entries().size());
- const char* kManifestPath = tested_manifest1_path_override_ ?
- tested_manifest1_path_override_ :
+ const char* kManifestPath = tested_manifest_path_override_ ?
+ tested_manifest_path_override_ :
"files/manifest1";
AppCacheEntry* entry =
cache->GetEntry(MockHttpServer::GetMockUrl(kManifestPath));
@@ -3043,10 +3100,13 @@ class AppCacheUpdateJobTest : public testing::Test,
}
void VerifyEmptyManifest(AppCache* cache) {
+ const char* kManifestPath = tested_manifest_path_override_ ?
+ tested_manifest_path_override_ :
+ "files/empty-manifest";
size_t expected = 1;
EXPECT_EQ(expected, cache->entries().size());
AppCacheEntry* entry = cache->GetEntry(
- MockHttpServer::GetMockUrl("files/empty-manifest"));
+ MockHttpServer::GetMockUrl(kManifestPath));
ASSERT_TRUE(entry);
EXPECT_EQ(AppCacheEntry::MANIFEST, entry->types());
@@ -3143,7 +3203,7 @@ class AppCacheUpdateJobTest : public testing::Test,
bool expect_non_null_update_time_;
std::vector<MockFrontend*> frontends_; // to check expected events
TestedManifest tested_manifest_;
- const char* tested_manifest1_path_override_;
+ const char* tested_manifest_path_override_;
AppCache::EntryMap expect_extra_entries_;
std::map<GURL, int64> expect_response_ids_;
@@ -3339,6 +3399,11 @@ TEST_F(AppCacheUpdateJobTest, FailStoreNewestCache) {
RunTestOnIOThread(&AppCacheUpdateJobTest::FailStoreNewestCacheTest);
}
+TEST_F(AppCacheUpdateJobTest, MasterEntryFailStoreNewestCacheTest) {
+ RunTestOnIOThread(
+ &AppCacheUpdateJobTest::MasterEntryFailStoreNewestCacheTest);
+}
+
TEST_F(AppCacheUpdateJobTest, UpgradeFailStoreNewestCache) {
RunTestOnIOThread(&AppCacheUpdateJobTest::UpgradeFailStoreNewestCacheTest);
}
diff --git a/webkit/appcache/mock_appcache_storage.cc b/webkit/appcache/mock_appcache_storage.cc
index 7e86ce4..6bf3e8d 100644
--- a/webkit/appcache/mock_appcache_storage.cc
+++ b/webkit/appcache/mock_appcache_storage.cc
@@ -189,7 +189,7 @@ void MockAppCacheStorage::ProcessStoreGroupAndNewestCache(
Delegate* delegate = delegate_ref->delegate;
if (simulate_store_group_and_newest_cache_failure_) {
if (delegate)
- delegate->OnGroupAndNewestCacheStored(group, newest_cache, false);
+ delegate->OnGroupAndNewestCacheStored(group, newest_cache, false, false);
return;
}
@@ -206,7 +206,7 @@ void MockAppCacheStorage::ProcessStoreGroupAndNewestCache(
}
if (delegate)
- delegate->OnGroupAndNewestCacheStored(group, newest_cache, true);
+ delegate->OnGroupAndNewestCacheStored(group, newest_cache, true, false);
}
namespace {
@@ -434,8 +434,8 @@ bool MockAppCacheStorage::ShouldGroupLoadAppearAsync(
// The LoadGroup interface implies also loading the newest cache, so
// if loading the newest cache should appear async, so too must the
// loading of this group.
- if (ShouldCacheLoadAppearAsync(group->newest_complete_cache()))
- return true;
+ if (!ShouldCacheLoadAppearAsync(group->newest_complete_cache()))
+ return false;
// If any of the old caches are "in use", then the group must also
diff --git a/webkit/appcache/mock_appcache_storage_unittest.cc b/webkit/appcache/mock_appcache_storage_unittest.cc
index 80e3b59..5be333a 100644
--- a/webkit/appcache/mock_appcache_storage_unittest.cc
+++ b/webkit/appcache/mock_appcache_storage_unittest.cc
@@ -32,7 +32,8 @@ class MockAppCacheStorageTest : public testing::Test {
}
void OnGroupAndNewestCacheStored(
- AppCacheGroup* group, AppCache* newest_cache, bool success) {
+ AppCacheGroup* group, AppCache* newest_cache, bool success,
+ bool would_exceed_quota) {
stored_group_ = group;
stored_group_success_ = success;
}