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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2196333002: PlzNavigate: Clear provisional history item on redirects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timing_api
Patch Set: Rebasing again, Trybot issues. Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 break; 202 break;
203 default: 203 default:
204 ASSERT_NOT_REACHED(); 204 ASSERT_NOT_REACHED();
205 } 205 }
206 206
207 if (resource) 207 if (resource)
208 fetcher()->preloadStarted(resource); 208 fetcher()->preloadStarted(resource);
209 return resource; 209 return resource;
210 } 210 }
211 211
212 void DocumentLoader::didRedirect(const KURL& oldURL, const KURL& newURL)
213 {
214 timing().addRedirect(oldURL, newURL);
215
216 // If a redirection happens during a back/forward navigation, don't restore
217 // any state from the old HistoryItem.
218 // There is a provisional history item for back/forward navigation only.
219 // In the other case, clearing it is a no-op.
220 DCHECK(frameLoader());
221 frameLoader()->clearProvisionalHistoryItem();
222 }
223
212 void DocumentLoader::dispatchLinkHeaderPreloads(ViewportDescriptionWrapper* view port, LinkLoader::MediaPreloadPolicy mediaPolicy) 224 void DocumentLoader::dispatchLinkHeaderPreloads(ViewportDescriptionWrapper* view port, LinkLoader::MediaPreloadPolicy mediaPolicy)
213 { 225 {
214 LinkLoader::loadLinksFromHeader(response().httpHeaderField(HTTPNames::Link), response().url(), m_frame->document(), NetworkHintsInterfaceImpl(), LinkLoader: :OnlyLoadResources, mediaPolicy, viewport); 226 LinkLoader::loadLinksFromHeader(response().httpHeaderField(HTTPNames::Link), response().url(), m_frame->document(), NetworkHintsInterfaceImpl(), LinkLoader: :OnlyLoadResources, mediaPolicy, viewport);
215 } 227 }
216 228
217 void DocumentLoader::didChangePerformanceTiming() 229 void DocumentLoader::didChangePerformanceTiming()
218 { 230 {
219 if (frame() && frame()->isMainFrame() && m_state >= Committed) { 231 if (frame() && frame()->isMainFrame() && m_state >= Committed) {
220 frameLoader()->client()->didChangePerformanceTiming(); 232 frameLoader()->client()->didChangePerformanceTiming();
221 } 233 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString()); 334 FrameLoader::reportLocalLoadFailed(m_frame, requestURL.getString());
323 m_fetcher->stopFetching(); 335 m_fetcher->stopFetching();
324 return; 336 return;
325 } 337 }
326 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre ntTab, replacesCurrentHistoryItem(), isClientRedirect())) { 338 if (!frameLoader()->shouldContinueForNavigationPolicy(m_request, SubstituteD ata(), this, CheckContentSecurityPolicy, m_navigationType, NavigationPolicyCurre ntTab, replacesCurrentHistoryItem(), isClientRedirect())) {
327 m_fetcher->stopFetching(); 339 m_fetcher->stopFetching();
328 return; 340 return;
329 } 341 }
330 342
331 ASSERT(timing().fetchStart()); 343 ASSERT(timing().fetchStart());
332 timing().addRedirect(redirectResponse.url(), requestURL);
333 appendRedirect(requestURL); 344 appendRedirect(requestURL);
334 frameLoader()->receivedMainResourceRedirect(requestURL); 345 didRedirect(redirectResponse.url(), requestURL);
346 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad( );
335 } 347 }
336 348
337 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) 349 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame)
338 { 350 {
339 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi meRegistry::IsSupported) 351 if (Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) == WebMi meRegistry::IsSupported)
340 return true; 352 return true;
341 PluginData* pluginData = frame->pluginData(); 353 PluginData* pluginData = frame->pluginData();
342 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim eType); 354 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim eType);
343 } 355 }
344 356
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 { 730 {
719 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing); 731 m_writer = createWriterFor(init, mimeType(), m_writer ? m_writer->encoding() : emptyAtom, true, ForceSynchronousParsing);
720 if (!source.isNull()) 732 if (!source.isNull())
721 m_writer->appendReplacingData(source); 733 m_writer->appendReplacingData(source);
722 endWriting(m_writer.get()); 734 endWriting(m_writer.get());
723 } 735 }
724 736
725 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 737 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
726 738
727 } // namespace blink 739 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.h ('k') | third_party/WebKit/Source/core/loader/FrameLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698