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

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

Issue 59043006: Avoid reusing XMLHttpRequest resources during document load. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reduce scope of test to lessen timeout potential Created 7 years, 1 month 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
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/sync-repeated-and-caching-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 // with this one, or vice versa, re-fetch the resource. 853 // with this one, or vice versa, re-fetch the resource.
854 // 854 //
855 // This helps with the case where the server sends back 855 // This helps with the case where the server sends back
856 // "Access-Control-Allow-Origin: *" all the time, but some of the 856 // "Access-Control-Allow-Origin: *" all the time, but some of the
857 // client's requests are made without CORS and some with. 857 // client's requests are made without CORS and some with.
858 if (existingResource->resourceRequest().allowCookies() != request.allowCooki es()) { 858 if (existingResource->resourceRequest().allowCookies() != request.allowCooki es()) {
859 LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy reloa ding due to difference in credentials settings."); 859 LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy reloa ding due to difference in credentials settings.");
860 return Reload; 860 return Reload;
861 } 861 }
862 862
863 // During the initial load, avoid loading the same resource multiple times f or a single document, even if the cache policies would tell us to. 863 // During the initial load, avoid loading the same resource multiple times f or a single document,
864 if (document() && !document()->loadEventFinished() && m_validatedURLs.contai ns(existingResource->url())) 864 // even if the cache policies would tell us to. Raw resources are exempted.
865 if (type != Resource::Raw && document() && !document()->loadEventFinished() && m_validatedURLs.contains(existingResource->url()))
865 return Use; 866 return Use;
866 867
867 // CachePolicyReload always reloads 868 // CachePolicyReload always reloads
868 if (context().cachePolicy(type) == CachePolicyReload) { 869 if (context().cachePolicy(type) == CachePolicyReload) {
869 LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy reloa ding due to CachePolicyReload."); 870 LOG(ResourceLoading, "ResourceFetcher::determineRevalidationPolicy reloa ding due to CachePolicyReload.");
870 return Reload; 871 return Reload;
871 } 872 }
872 873
873 // We'll try to reload the resource if it failed last time. 874 // We'll try to reload the resource if it failed last time.
874 if (existingResource->errorOccurred()) { 875 if (existingResource->errorOccurred()) {
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 } 1321 }
1321 #endif 1322 #endif
1322 1323
1323 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions() 1324 const ResourceLoaderOptions& ResourceFetcher::defaultResourceOptions()
1324 { 1325 {
1325 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaul tOriginRestrictionsForType, DocumentContext)); 1326 DEFINE_STATIC_LOCAL(ResourceLoaderOptions, options, (SendCallbacks, SniffCon tent, BufferData, AllowStoredCredentials, ClientRequestedCredentials, AskClientF orCrossOriginCredentials, DoSecurityCheck, CheckContentSecurityPolicy, UseDefaul tOriginRestrictionsForType, DocumentContext));
1326 return options; 1327 return options;
1327 } 1328 }
1328 1329
1329 } 1330 }
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/sync-repeated-and-caching-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698