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

Unified Diff: chrome/browser/prerender/prerender_contents.cc

Issue 233353003: Only commit cookie changes in prerenders after a prerender is shown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add browser tests, fix a bug in what was changed yesterday. Created 6 years, 7 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
Index: chrome/browser/prerender/prerender_contents.cc
===================================================================
--- chrome/browser/prerender/prerender_contents.cc (revision 265252)
+++ chrome/browser/prerender/prerender_contents.cc (working copy)
@@ -289,7 +289,8 @@
void PrerenderContents::StartPrerendering(
int creator_child_id,
const gfx::Size& size,
- SessionStorageNamespace* session_storage_namespace) {
+ SessionStorageNamespace* session_storage_namespace,
+ net::URLRequestContextGetter* request_context) {
DCHECK(profile_ != NULL);
DCHECK(!size.IsEmpty());
DCHECK(!prerendering_has_started_);
@@ -337,6 +338,17 @@
// the event of a mismatch.
alias_session_storage_namespace->AddTransactionLogProcessId(child_id_);
+ // Add this prerender to the prerender tracker. This will create a
+ // Prerender Cookie Store to keep track of cookie changes performed by the
+ // prerender. Once the prerender is shown, the cookie changes will be
+ // committed to the actual cookie store, otherwise, they will be discarded.
+ prerender_manager()->prerender_tracker()->AddPrerender(
+ GetRenderViewHost()->GetProcess(),
+ request_context,
+ base::Bind(&PrerenderContents::Destroy,
+ AsWeakPtr(),
+ FINAL_STATUS_COOKIE_CONFLICT));
+
NotifyPrerenderStart();
// Close ourselves when the application is shutting down.

Powered by Google App Engine
This is Rietveld 408576698