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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 22982011: Reland "Fix form resubmissions happening silently." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: With fix Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 break; 617 break;
618 } 618 }
619 request.setTargetType(targetType); 619 request.setTargetType(targetType);
620 } 620 }
621 621
622 ResourceRequestCachePolicy ResourceFetcher::resourceRequestCachePolicy(const Res ourceRequest& request, Resource::Type type) 622 ResourceRequestCachePolicy ResourceFetcher::resourceRequestCachePolicy(const Res ourceRequest& request, Resource::Type type)
623 { 623 {
624 if (type == Resource::MainResource) { 624 if (type == Resource::MainResource) {
625 FrameLoadType frameLoadType = frame()->loader()->loadType(); 625 FrameLoadType frameLoadType = frame()->loader()->loadType();
626 bool isReload = frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin; 626 bool isReload = frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin;
627 if (request.httpMethod() == "POST" && (isReload || frameLoadType == Fram eLoadTypeBackForward))
628 return ReturnCacheDataDontLoad;
Nate Chapin 2013/08/27 21:12:41 This deletion is the only diff from what I attempt
abarth-chromium 2013/08/27 23:39:44 We talked about this in person. I think this line
629 if (!m_documentLoader->overrideEncoding().isEmpty() || frameLoadType == FrameLoadTypeBackForward) 627 if (!m_documentLoader->overrideEncoding().isEmpty() || frameLoadType == FrameLoadTypeBackForward)
630 return ReturnCacheDataElseLoad; 628 return ReturnCacheDataElseLoad;
631 if (isReload || frameLoadType == FrameLoadTypeSame || request.isConditio nal()) 629 if (isReload || frameLoadType == FrameLoadTypeSame || request.isConditio nal() || request.httpMethod() == "POST")
632 return ReloadIgnoringCacheData; 630 return ReloadIgnoringCacheData;
633 return UseProtocolCachePolicy; 631 return UseProtocolCachePolicy;
634 } 632 }
635 633
636 if (request.isConditional()) 634 if (request.isConditional())
637 return ReloadIgnoringCacheData; 635 return ReloadIgnoringCacheData;
638 636
639 if (m_documentLoader && m_documentLoader->isLoadingInAPISense()) { 637 if (m_documentLoader && m_documentLoader->isLoadingInAPISense()) {
640 // For POST requests, we mutate the main resource's cache policy to avoi d form resubmission. 638 // For POST requests, we mutate the main resource's cache policy to avoi d form resubmission.
641 // This policy should not be inherited by subresources. 639 // This policy should not be inherited by subresources.
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 } 1285 }
1288 #endif 1286 #endif
1289 1287
1290 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions() 1288 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions()
1291 { 1289 {
1292 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaul tOriginRestrictionsForType, DocumentContext)); 1290 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaul tOriginRestrictionsForType, DocumentContext));
1293 return options; 1291 return options;
1294 } 1292 }
1295 1293
1296 } 1294 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/history/back-to-post-expected.txt ('k') | Source/core/loader/DocumentLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698