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

Unified Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2410303006: Avoiding going through RenderFrameProxy when targeting a *new* frame. (Closed)
Patch Set: s/shift/ctrl/ in a "comment" in the test html file. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/frame_tree/anchor_targeting_remote_frame.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 983da54d2946b42c414fe22086963c0c496f1dbd..0d747116c33fbd3a16e46ee4bd2f29bc1b866f28 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -969,6 +969,37 @@ static bool shouldOpenInNewWindow(Frame* targetFrame,
return request.form() && policy != NavigationPolicyCurrentTab;
}
+static bool shouldNavigateTargetFrame(NavigationPolicy policy) {
+ switch (policy) {
+ case NavigationPolicyCurrentTab:
+ return true;
+
+ // Navigation will target a *new* frame (e.g. because of a ctrl-click),
+ // so the target frame can be ignored.
+ case NavigationPolicyNewBackgroundTab:
+ case NavigationPolicyNewForegroundTab:
+ case NavigationPolicyNewWindow:
+ case NavigationPolicyNewPopup:
+ return false;
+
+ // Navigation won't really target any specific frame,
+ // so the target frame can be ignored.
+ case NavigationPolicyIgnore:
+ case NavigationPolicyDownload:
+ return false;
+
+ case NavigationPolicyHandledByClient:
+ // Impossible, because at this point we shouldn't yet have called
+ // client()->decidePolicyForNavigation(...).
+ NOTREACHED();
+ return true;
+
+ default:
+ NOTREACHED() << policy;
+ return true;
+ }
+}
+
static NavigationType determineNavigationType(FrameLoadType frameLoadType,
bool isFormSubmission,
bool haveEvent) {
@@ -1065,17 +1096,18 @@ void FrameLoader::load(const FrameLoadRequest& passedRequest,
if (!prepareRequestForThisFrame(request))
return;
- Frame* targetFrame = request.form()
- ? nullptr
- : m_frame->findFrameForNavigation(
- AtomicString(request.frameName()), *m_frame);
-
if (isBackForwardLoadType(frameLoadType)) {
DCHECK(historyItem);
m_provisionalItem = historyItem;
}
- if (targetFrame && targetFrame != m_frame) {
+ Frame* targetFrame = request.form()
+ ? nullptr
+ : m_frame->findFrameForNavigation(
+ AtomicString(request.frameName()), *m_frame);
+ NavigationPolicy policy = navigationPolicyForRequest(request);
+ if (targetFrame && targetFrame != m_frame &&
+ shouldNavigateTargetFrame(policy)) {
bool wasInSamePage = targetFrame->page() == m_frame->page();
request.setFrameName("_self");
@@ -1088,10 +1120,6 @@ void FrameLoader::load(const FrameLoadRequest& passedRequest,
setReferrerForFrameRequest(request);
- FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard)
- ? determineFrameLoadType(request)
- : frameLoadType;
- NavigationPolicy policy = navigationPolicyForRequest(request);
if (shouldOpenInNewWindow(targetFrame, request, policy)) {
if (policy == NavigationPolicyDownload) {
client()->loadURLExternally(request.resourceRequest(),
@@ -1104,6 +1132,9 @@ void FrameLoader::load(const FrameLoadRequest& passedRequest,
}
const KURL& url = request.resourceRequest().url();
+ FrameLoadType newLoadType = (frameLoadType == FrameLoadTypeStandard)
+ ? determineFrameLoadType(request)
+ : frameLoadType;
bool sameDocumentHistoryNavigation =
isBackForwardLoadType(newLoadType) &&
historyLoadType == HistorySameDocumentLoad;
« no previous file with comments | « chrome/test/data/frame_tree/anchor_targeting_remote_frame.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698