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

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

Issue 410223003: location.reload() after POST should re-POST (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add comment about ClientRedirectPolicy in FrameLoader::reload() Created 6 years, 4 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/FrameLoader.h ('k') | Source/core/loader/NavigationScheduler.cpp » ('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, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 if (formData) { 810 if (formData) {
811 request.setHTTPMethod("POST"); 811 request.setHTTPMethod("POST");
812 request.setHTTPBody(formData); 812 request.setHTTPBody(formData);
813 request.setHTTPContentType(item->formContentType()); 813 request.setHTTPContentType(item->formContentType());
814 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer); 814 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString (item->referrer().referrer);
815 request.addHTTPOriginIfNeeded(securityOrigin->toAtomicString()); 815 request.addHTTPOriginIfNeeded(securityOrigin->toAtomicString());
816 } 816 }
817 return request; 817 return request;
818 } 818 }
819 819
820 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con st AtomicString& overrideEncoding) 820 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con st AtomicString& overrideEncoding, ClientRedirectPolicy clientRedirectPolicy)
821 { 821 {
822 if (!m_currentItem) 822 if (!m_currentItem)
823 return; 823 return;
824 824
825 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re loadBypassingCache : ReloadIgnoringCacheData; 825 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re loadBypassingCache : ReloadIgnoringCacheData;
826 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP olicy); 826 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP olicy);
827 request.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTypeTopLev el : WebURLRequest::FrameTypeNested); 827 request.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTypeTopLev el : WebURLRequest::FrameTypeNested);
828 request.setRequestContext(WebURLRequest::RequestContextInternal); 828 request.setRequestContext(WebURLRequest::RequestContextInternal);
829
830 // ClientRedirectPolicy is an indication that this load was triggered by
831 // some direct interaction with the page. If this reload is not a client
832 // redirect, we should reuse the referrer from the original load of the
833 // current document. If this reload is a client redirect (e.g., location.rel oad()),
834 // it was initiated by something in the current document and should
835 // therefore show the current document's url as the referrer.
836 if (clientRedirectPolicy == ClientRedirect)
837 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer() , m_frame->document()->referrerPolicy()));
838
829 if (!overrideURL.isEmpty()) { 839 if (!overrideURL.isEmpty()) {
830 request.setURL(overrideURL); 840 request.setURL(overrideURL);
831 request.clearHTTPReferrer(); 841 request.clearHTTPReferrer();
832 } 842 }
833 843
834 FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFro mOrigin : FrameLoadTypeReload; 844 FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFro mOrigin : FrameLoadTypeReload;
835 loadWithNavigationAction(NavigationAction(request, type), type, nullptr, Sub stituteData(), CheckContentSecurityPolicy, NotClientRedirect, overrideEncoding); 845 loadWithNavigationAction(NavigationAction(request, type), type, nullptr, Sub stituteData(), CheckContentSecurityPolicy, clientRedirectPolicy, overrideEncodin g);
836 } 846 }
837 847
838 void FrameLoader::stopAllLoaders() 848 void FrameLoader::stopAllLoaders()
839 { 849 {
840 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 850 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
841 return; 851 return;
842 852
843 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. 853 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this.
844 if (m_inStopAllLoaders) 854 if (m_inStopAllLoaders)
845 return; 855 return;
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. 1525 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1516 Frame* parentFrame = m_frame->tree().parent(); 1526 Frame* parentFrame = m_frame->tree().parent();
1517 if (parentFrame && parentFrame->isLocalFrame()) 1527 if (parentFrame && parentFrame->isLocalFrame())
1518 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); 1528 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1519 if (FrameOwner* frameOwner = m_frame->owner()) 1529 if (FrameOwner* frameOwner = m_frame->owner())
1520 flags |= frameOwner->sandboxFlags(); 1530 flags |= frameOwner->sandboxFlags();
1521 return flags; 1531 return flags;
1522 } 1532 }
1523 1533
1524 } // namespace blink 1534 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/NavigationScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698