| 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;
|
|
|