Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(803)

Unified Diff: webkit/appcache/appcache_host.cc

Issue 6546004: Defend against selectCache() being called multiple times.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/appcache/appcache_host.h ('k') | webkit/appcache/web_application_cache_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_host.cc
===================================================================
--- webkit/appcache/appcache_host.cc (revision 75330)
+++ webkit/appcache/appcache_host.cc (working copy)
@@ -34,6 +34,7 @@
AppCacheHost::AppCacheHost(int host_id, AppCacheFrontend* frontend,
AppCacheService* service)
: host_id_(host_id), parent_host_id_(kNoHostId), parent_process_id_(0),
+ was_select_cache_called_(false),
pending_main_resource_cache_id_(kNoCacheId),
pending_selected_cache_id_(kNoCacheId),
frontend_(frontend), service_(service),
@@ -67,29 +68,17 @@
!pending_swap_cache_callback_ &&
!pending_get_status_callback_);
ericu 2011/02/18 01:27:34 Given that this condition is now prevented in the
michaeln 2011/02/18 01:41:46 Right, I'm being overly paranoid after seeing a CR
+ // This should not be called more than once per instance, but if a renderer
+ // some how does get confused and calls us twice, we ignore all but the
+ // first call.
+ if (was_select_cache_called_)
+ return;
+ was_select_cache_called_ = true;
+
if (main_resource_blocked_)
frontend_->OnContentBlocked(host_id_,
blocked_manifest_url_);
- // First we handle an unusual case of SelectCache being called a second
- // time. Generally this shouldn't happen, but with bad content I think
- // this can occur... <html manifest=foo> <html manifest=bar></html></html>
- // We handle this by killing whatever loading we have initiated, and by
- // unassociating any hosts we currently have associated... and starting
- // anew with the inputs to this SelectCache call.
- // TODO(michaeln): at some point determine what behavior the algorithms
- // described in the HTML5 draft produce and have our impl produce those
- // results (or suggest changes to the algorihtms described in the spec
- // if the resulting behavior is just too insane).
- if (is_selection_pending()) {
- service_->storage()->CancelDelegateCallbacks(this);
- pending_selected_manifest_url_ = GURL();
- pending_selected_cache_id_ = kNoCacheId;
- } else if (associated_cache()) {
- AssociateCache(NULL);
- }
- new_master_entry_url_ = GURL();
-
// 6.9.6 The application cache selection algorithm.
// The algorithm is started here and continues in FinishCacheSelection,
// after cache or group loading is complete.
« no previous file with comments | « webkit/appcache/appcache_host.h ('k') | webkit/appcache/web_application_cache_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698