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

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

Issue 126453005: Simplify starting a same-document navigation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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
« no previous file with comments | « Source/core/loader/DocumentLoader.h ('k') | Source/core/loader/FrameLoader.h » ('j') | 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) 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons t ResourceResponse& redirectResponse) 295 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons t ResourceResponse& redirectResponse)
296 { 296 {
297 int status = redirectResponse.httpStatusCode(); 297 int status = redirectResponse.httpStatusCode();
298 if (((status >= 301 && status <= 303) || status == 307) 298 if (((status >= 301 && status <= 303) || status == 307)
299 && m_originalRequest.httpMethod() == "POST") 299 && m_originalRequest.httpMethod() == "POST")
300 return true; 300 return true;
301 301
302 return false; 302 return false;
303 } 303 }
304 304
305 bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& re quest, PolicyCheckLoadType policyCheckLoadType) 305 bool DocumentLoader::shouldContinueForNavigationPolicy(const ResourceRequest& re quest)
306 { 306 {
307 // Don't ask if we are loading an empty URL. 307 // Don't ask if we are loading an empty URL.
308 if (request.url().isEmpty() || m_substituteData.isValid()) 308 if (request.url().isEmpty() || m_substituteData.isValid())
309 return true; 309 return true;
310 310
311 // If we're loading content into a subframe, check against the parent's Cont ent Security Policy 311 // If we're loading content into a subframe, check against the parent's Cont ent Security Policy
312 // and kill the load if that check fails. 312 // and kill the load if that check fails.
313 if (m_frame->ownerElement() && !m_frame->ownerElement()->document().contentS ecurityPolicy()->allowChildFrameFromSource(request.url())) 313 if (m_frame->ownerElement() && !m_frame->ownerElement()->document().contentS ecurityPolicy()->allowChildFrameFromSource(request.url()))
314 return false; 314 return false;
315 315
316 NavigationPolicy policy = m_triggeringAction.policy(); 316 NavigationPolicy policy = m_triggeringAction.policy();
317 if (policyCheckLoadType != PolicyCheckFragment) 317 policy = frameLoader()->client()->decidePolicyForNavigation(request, this, p olicy);
318 policy = frameLoader()->client()->decidePolicyForNavigation(request, thi s, policy);
319 if (policy == NavigationPolicyCurrentTab) 318 if (policy == NavigationPolicyCurrentTab)
320 return true; 319 return true;
321 if (policy == NavigationPolicyIgnore) 320 if (policy == NavigationPolicyIgnore)
322 return false; 321 return false;
323 if (!DOMWindow::allowPopUp(m_frame) && !UserGestureIndicator::processingUser Gesture()) 322 if (!DOMWindow::allowPopUp(m_frame) && !UserGestureIndicator::processingUser Gesture())
324 return false; 323 return false;
325 frameLoader()->client()->loadURLExternally(request, policy); 324 frameLoader()->client()->loadURLExternally(request, policy);
326 return false; 325 return false;
327 } 326 }
328 327
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 386 }
388 } 387 }
389 388
390 m_request = newRequest; 389 m_request = newRequest;
391 390
392 if (redirectResponse.isNull()) 391 if (redirectResponse.isNull())
393 return; 392 return;
394 393
395 appendRedirect(newRequest.url()); 394 appendRedirect(newRequest.url());
396 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad( ); 395 frameLoader()->client()->dispatchDidReceiveServerRedirectForProvisionalLoad( );
397 if (!shouldContinueForNavigationPolicy(newRequest, PolicyCheckStandard)) 396 if (!shouldContinueForNavigationPolicy(newRequest))
398 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); 397 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()));
399 } 398 }
400 399
401 static bool canShowMIMEType(const String& mimeType, Page* page) 400 static bool canShowMIMEType(const String& mimeType, Page* page)
402 { 401 {
403 if (blink::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) = = blink::WebMimeRegistry::IsSupported) 402 if (blink::Platform::current()->mimeRegistry()->supportsMIMEType(mimeType) = = blink::WebMimeRegistry::IsSupported)
404 return true; 403 return true;
405 PluginData* pluginData = page->pluginData(); 404 PluginData* pluginData = page->pluginData();
406 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim eType); 405 return !mimeType.isEmpty() && pluginData && pluginData->supportsMimeType(mim eType);
407 } 406 }
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume nt) 863 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume nt)
865 { 864 {
866 m_frame->loader().stopAllLoaders(); 865 m_frame->loader().stopAllLoaders();
867 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url( ), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer ->encodingWasChosenByUser() : false, true); 866 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url( ), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer ->encodingWasChosenByUser() : false, true);
868 if (!source.isNull()) 867 if (!source.isNull())
869 m_writer->appendReplacingData(source); 868 m_writer->appendReplacingData(source);
870 endWriting(m_writer.get()); 869 endWriting(m_writer.get());
871 } 870 }
872 871
873 } // namespace WebCore 872 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/DocumentLoader.h ('k') | Source/core/loader/FrameLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698