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

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

Issue 2653953005: PlzNavigate: transmit redirect info to the renderer side (Closed)
Patch Set: Rebase + addressed comments Created 3 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 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 221
222 // CSP layout tests verify that preloads are subject to access checks by 222 // CSP layout tests verify that preloads are subject to access checks by
223 // seeing if they are in the `preload started` list. Therefore do not add 223 // seeing if they are in the `preload started` list. Therefore do not add
224 // them to the list if the load is immediately denied. 224 // them to the list if the load is immediately denied.
225 if (resource && !resource->resourceError().isAccessCheck()) 225 if (resource && !resource->resourceError().isAccessCheck())
226 fetcher()->preloadStarted(resource); 226 fetcher()->preloadStarted(resource);
227 return resource; 227 return resource;
228 } 228 }
229 229
230 void DocumentLoader::didRedirect(const KURL& oldURL, const KURL& newURL) {
231 timing().addRedirect(oldURL, newURL);
232
233 // If a redirection happens during a back/forward navigation, don't restore
234 // any state from the old HistoryItem. There is a provisional history item for
235 // back/forward navigation only. In the other case, clearing it is a no-op.
236 frameLoader().clearProvisionalHistoryItem();
237 }
238
239 void DocumentLoader::dispatchLinkHeaderPreloads( 230 void DocumentLoader::dispatchLinkHeaderPreloads(
240 ViewportDescriptionWrapper* viewport, 231 ViewportDescriptionWrapper* viewport,
241 LinkLoader::MediaPreloadPolicy mediaPolicy) { 232 LinkLoader::MediaPreloadPolicy mediaPolicy) {
242 LinkLoader::loadLinksFromHeader( 233 LinkLoader::loadLinksFromHeader(
243 response().httpHeaderField(HTTPNames::Link), response().url(), 234 response().httpHeaderField(HTTPNames::Link), response().url(),
244 m_frame->document(), NetworkHintsInterfaceImpl(), 235 m_frame->document(), NetworkHintsInterfaceImpl(),
245 LinkLoader::OnlyLoadResources, mediaPolicy, viewport); 236 LinkLoader::OnlyLoadResources, mediaPolicy, viewport);
246 } 237 }
247 238
248 void DocumentLoader::didChangePerformanceTiming() { 239 void DocumentLoader::didChangePerformanceTiming() {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 if (!frameLoader().shouldContinueForNavigationPolicy( 366 if (!frameLoader().shouldContinueForNavigationPolicy(
376 m_request, SubstituteData(), this, CheckContentSecurityPolicy, 367 m_request, SubstituteData(), this, CheckContentSecurityPolicy,
377 m_navigationType, NavigationPolicyCurrentTab, m_loadType, 368 m_navigationType, NavigationPolicyCurrentTab, m_loadType,
378 isClientRedirect(), nullptr)) { 369 isClientRedirect(), nullptr)) {
379 m_fetcher->stopFetching(); 370 m_fetcher->stopFetching();
380 return false; 371 return false;
381 } 372 }
382 373
383 DCHECK(timing().fetchStart()); 374 DCHECK(timing().fetchStart());
384 appendRedirect(requestURL); 375 appendRedirect(requestURL);
385 didRedirect(redirectResponse.url(), requestURL); 376 timing().addRedirect(redirectResponse.url(), requestURL);
377
378 // If a redirection happens during a back/forward navigation, don't restore
379 // any state from the old HistoryItem. There is a provisional history item for
380 // back/forward navigation only. In the other case, clearing it is a no-op.
381 frameLoader().clearProvisionalHistoryItem();
382
386 frameLoaderClient().dispatchDidReceiveServerRedirectForProvisionalLoad(); 383 frameLoaderClient().dispatchDidReceiveServerRedirectForProvisionalLoad();
387 384
388 return true; 385 return true;
389 } 386 }
390 387
391 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) { 388 static bool canShowMIMEType(const String& mimeType, LocalFrame* frame) {
392 if (MIMETypeRegistry::isSupportedMIMEType(mimeType)) 389 if (MIMETypeRegistry::isSupportedMIMEType(mimeType))
393 return true; 390 return true;
394 PluginData* pluginData = frame->pluginData(); 391 PluginData* pluginData = frame->pluginData();
395 return !mimeType.isEmpty() && pluginData && 392 return !mimeType.isEmpty() && pluginData &&
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 m_writer ? m_writer->encoding() : emptyAtom, true, 810 m_writer ? m_writer->encoding() : emptyAtom, true,
814 ForceSynchronousParsing); 811 ForceSynchronousParsing);
815 if (!source.isNull()) 812 if (!source.isNull())
816 m_writer->appendReplacingData(source); 813 m_writer->appendReplacingData(source);
817 endWriting(); 814 endWriting();
818 } 815 }
819 816
820 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader); 817 DEFINE_WEAK_IDENTIFIER_MAP(DocumentLoader);
821 818
822 } // namespace blink 819 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentLoader.h ('k') | third_party/WebKit/Source/web/WebDataSourceImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698