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

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

Issue 14610003: Revert "Remove FrameLoadTypeSame" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 | « no previous file | Source/core/loader/FrameLoaderTypes.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, 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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 RefPtr<FormState> formState = prpFormState; 1070 RefPtr<FormState> formState = prpFormState;
1071 bool isFormSubmission = formState; 1071 bool isFormSubmission = formState;
1072 1072
1073 ResourceRequest request(newURL); 1073 ResourceRequest request(newURL);
1074 if (!referrer.isEmpty()) { 1074 if (!referrer.isEmpty()) {
1075 request.setHTTPReferrer(referrer); 1075 request.setHTTPReferrer(referrer);
1076 RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString (referrer); 1076 RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString (referrer);
1077 addHTTPOriginIfNeeded(request, referrerOrigin->toString()); 1077 addHTTPOriginIfNeeded(request, referrerOrigin->toString());
1078 } 1078 }
1079 1079
1080 ASSERT(newLoadType != FrameLoadTypeSame);
1081
1080 // The search for a target frame is done earlier in the case of form submiss ion. 1082 // The search for a target frame is done earlier in the case of form submiss ion.
1081 Frame* targetFrame = isFormSubmission ? 0 : findFrameForNavigation(frameName ); 1083 Frame* targetFrame = isFormSubmission ? 0 : findFrameForNavigation(frameName );
1082 if (targetFrame && targetFrame != m_frame) { 1084 if (targetFrame && targetFrame != m_frame) {
1083 targetFrame->loader()->loadURL(newURL, referrer, "_self", newLoadType, e vent, formState.release()); 1085 targetFrame->loader()->loadURL(newURL, referrer, "_self", newLoadType, e vent, formState.release());
1084 return; 1086 return;
1085 } 1087 }
1086 1088
1087 if (m_pageDismissalEventBeingDispatched != NoDismissal) 1089 if (m_pageDismissalEventBeingDispatched != NoDismissal)
1088 return; 1090 return;
1089 1091
1090 NavigationAction action(request, newLoadType, isFormSubmission, event); 1092 NavigationAction action(request, newLoadType, isFormSubmission, event);
1091 1093
1092 if (!targetFrame && !frameName.isEmpty()) { 1094 if (!targetFrame && !frameName.isEmpty()) {
1093 checkNewWindowPolicyAndContinue(formState.release(), frameName, action); 1095 checkNewWindowPolicyAndContinue(formState.release(), frameName, action);
1094 return; 1096 return;
1095 } 1097 }
1096 1098
1099 bool sameURL = shouldTreatURLAsSameAsCurrent(newURL);
1097 loadWithNavigationAction(request, action, newLoadType, formState.release(), defaultSubstituteDataForURL(request.url())); 1100 loadWithNavigationAction(request, action, newLoadType, formState.release(), defaultSubstituteDataForURL(request.url()));
1101 // Example of this case are sites that reload the same URL with a different cookie
1102 // driving the generated content, or a master frame with links that drive a target
1103 // frame, where the user has clicked on the same link repeatedly.
1104 if (sameURL && newLoadType != FrameLoadTypeReload && newLoadType != FrameLoa dTypeReloadFromOrigin)
1105 m_loadType = FrameLoadTypeSame;
1098 } 1106 }
1099 1107
1100 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) 1108 SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url)
1101 { 1109 {
1102 if (!shouldTreatURLAsSrcdocDocument(url)) 1110 if (!shouldTreatURLAsSrcdocDocument(url))
1103 return SubstituteData(); 1111 return SubstituteData();
1104 String srcdoc = m_frame->ownerElement()->fastGetAttribute(srcdocAttr); 1112 String srcdoc = m_frame->ownerElement()->fastGetAttribute(srcdocAttr);
1105 ASSERT(!srcdoc.isNull()); 1113 ASSERT(!srcdoc.isNull());
1106 CString encodedSrcdoc = srcdoc.utf8(); 1114 CString encodedSrcdoc = srcdoc.utf8();
1107 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd oc.length()), "text/html", "UTF-8", KURL()); 1115 return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcd oc.length()), "text/html", "UTF-8", KURL());
(...skipping 15 matching lines...) Expand all
1123 } 1131 }
1124 1132
1125 if (!request.hasSubstituteData()) 1133 if (!request.hasSubstituteData())
1126 request.setSubstituteData(defaultSubstituteDataForURL(request.resourceRe quest().url())); 1134 request.setSubstituteData(defaultSubstituteDataForURL(request.resourceRe quest().url()));
1127 1135
1128 ResourceRequest& r = request.resourceRequest(); 1136 ResourceRequest& r = request.resourceRequest();
1129 const KURL& unreachableURL = request.substituteData().failingURL(); 1137 const KURL& unreachableURL = request.substituteData().failingURL();
1130 1138
1131 FrameLoadType type; 1139 FrameLoadType type;
1132 if (shouldTreatURLAsSameAsCurrent(r.url())) 1140 if (shouldTreatURLAsSameAsCurrent(r.url()))
1133 type = FrameLoadTypeReload; 1141 type = FrameLoadTypeSame;
1134 else if (shouldTreatURLAsSameAsCurrent(unreachableURL) && m_loadType == Fram eLoadTypeReload) 1142 else if (shouldTreatURLAsSameAsCurrent(unreachableURL) && m_loadType == Fram eLoadTypeReload)
1135 type = FrameLoadTypeReload; 1143 type = FrameLoadTypeReload;
1136 else 1144 else
1137 type = FrameLoadTypeStandard; 1145 type = FrameLoadTypeStandard;
1138 1146
1139 // When we loading alternate content for an unreachable URL that we're 1147 // When we loading alternate content for an unreachable URL that we're
1140 // visiting in the history list, we treat it as a reload so the history list 1148 // visiting in the history list, we treat it as a reload so the history list
1141 // is appropriately maintained. 1149 // is appropriately maintained.
1142 // 1150 //
1143 // FIXME: This seems like a dangerous overloading of the meaning of "FrameLo adTypeReload" ... 1151 // FIXME: This seems like a dangerous overloading of the meaning of "FrameLo adTypeReload" ...
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 { 2066 {
2059 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading, 2067 // We don't do this if we are submitting a form with method other than "GET" , explicitly reloading,
2060 // currently displaying a frameset, or if the URL does not have a fragment. 2068 // currently displaying a frameset, or if the URL does not have a fragment.
2061 // These rules were originally based on what KHTML was doing in KHTMLPart::o penURL. 2069 // These rules were originally based on what KHTML was doing in KHTMLPart::o penURL.
2062 2070
2063 // FIXME: What about load types other than Standard and Reload? 2071 // FIXME: What about load types other than Standard and Reload?
2064 2072
2065 return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET")) 2073 return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET"))
2066 && loadType != FrameLoadTypeReload 2074 && loadType != FrameLoadTypeReload
2067 && loadType != FrameLoadTypeReloadFromOrigin 2075 && loadType != FrameLoadTypeReloadFromOrigin
2076 && loadType != FrameLoadTypeSame
2068 && !shouldReload(m_frame->document()->url(), url) 2077 && !shouldReload(m_frame->document()->url(), url)
2069 // We don't want to just scroll if a link from within a 2078 // We don't want to just scroll if a link from within a
2070 // frameset is trying to reload the frameset into _top. 2079 // frameset is trying to reload the frameset into _top.
2071 && !m_frame->document()->isFrameSet(); 2080 && !m_frame->document()->isFrameSet();
2072 } 2081 }
2073 2082
2074 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) 2083 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url)
2075 { 2084 {
2076 FrameView* view = m_frame->view(); 2085 FrameView* view = m_frame->view();
2077 if (!view) 2086 if (!view)
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect); 2693 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
2685 2694
2686 page->chrome()->setWindowRect(newWindowRect); 2695 page->chrome()->setWindowRect(newWindowRect);
2687 page->chrome()->show(); 2696 page->chrome()->show();
2688 2697
2689 created = true; 2698 created = true;
2690 return frame; 2699 return frame;
2691 } 2700 }
2692 2701
2693 } // namespace WebCore 2702 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/loader/FrameLoaderTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698