Modified: trunk/Source/WebCore/ChangeLog (260422 => 260423)
--- trunk/Source/WebCore/ChangeLog 2020-04-21 10:28:37 UTC (rev 260422)
+++ trunk/Source/WebCore/ChangeLog 2020-04-21 10:31:08 UTC (rev 260423)
@@ -1,3 +1,18 @@
+2020-04-21 Rob Buis <[email protected]>
+
+ Exit early in FrameLoader::loadURL when redirecting to another frame
+ https://bugs.webkit.org/show_bug.cgi?id=210751
+
+ Reviewed by Geoffrey Garen.
+
+ Exit early in FrameLoader::loadURL when redirecting to another frame, previously we were preparing
+ request needlessly, doing it twice in case of frame redirecting. Also move some variables to
+ where they are actually used.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadURL):
+ * loader/FrameLoader.h:
+
2020-04-21 Carlos Garcia Campos <[email protected]>
[GTK] Remove PlatformMouseEventGtk
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (260422 => 260423)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2020-04-21 10:28:37 UTC (rev 260422)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2020-04-21 10:31:08 UTC (rev 260423)
@@ -1352,11 +1352,16 @@
// Anchor target is ignored when the download attribute is set since it will download the hyperlink rather than follow it.
String effectiveFrameName = frameLoadRequest.downloadAttribute().isNull() ? frameLoadRequest.frameName() : String();
- AllowNavigationToInvalidURL allowNavigationToInvalidURL = frameLoadRequest.allowNavigationToInvalidURL();
- NewFrameOpenerPolicy openerPolicy = frameLoadRequest.newFrameOpenerPolicy();
- LockHistory lockHistory = frameLoadRequest.lockHistory();
bool isFormSubmission = formState;
+ // The search for a target frame is done earlier in the case of form submission.
+ auto targetFrame = isFormSubmission ? nullptr : makeRefPtr(findFrameForNavigation(effectiveFrameName));
+ if (targetFrame && targetFrame != &m_frame) {
+ frameLoadRequest.setFrameName("_self");
+ targetFrame->loader().loadURL(WTFMove(frameLoadRequest), referrer, newLoadType, event, WTFMove(formState), WTFMove(adClickAttribution), completionHandlerCaller.release());
+ return;
+ }
+
const URL& newURL = frameLoadRequest.resourceRequest().url();
ResourceRequest request(newURL);
if (!referrer.isEmpty())
@@ -1366,23 +1371,17 @@
ASSERT(newLoadType != FrameLoadType::Same);
- // The search for a target frame is done earlier in the case of form submission.
- Frame* targetFrame = isFormSubmission ? nullptr : findFrameForNavigation(effectiveFrameName);
- if (targetFrame && targetFrame != &m_frame) {
- frameLoadRequest.setFrameName("_self");
- targetFrame->loader().loadURL(WTFMove(frameLoadRequest), referrer, newLoadType, event, WTFMove(formState), WTFMove(adClickAttribution), completionHandlerCaller.release());
- return;
- }
-
if (!isNavigationAllowed())
return;
NavigationAction action { frameLoadRequest.requester(), request, frameLoadRequest.initiatedByMainFrame(), newLoadType, isFormSubmission, event, frameLoadRequest.shouldOpenExternalURLsPolicy(), frameLoadRequest.downloadAttribute() };
- action.setLockHistory(lockHistory);
+ action.setLockHistory(frameLoadRequest.lockHistory());
action.setLockBackForwardList(frameLoadRequest.lockBackForwardList());
if (adClickAttribution && m_frame.isMainFrame())
action.setAdClickAttribution(WTFMove(*adClickAttribution));
+ NewFrameOpenerPolicy openerPolicy = frameLoadRequest.newFrameOpenerPolicy();
+ AllowNavigationToInvalidURL allowNavigationToInvalidURL = frameLoadRequest.allowNavigationToInvalidURL();
if (!targetFrame && !effectiveFrameName.isEmpty()) {
action = "" frameLoadRequest));
policyChecker().checkNewWindowPolicy(WTFMove(action), WTFMove(request), WTFMove(formState), effectiveFrameName, [this, allowNavigationToInvalidURL, openerPolicy, completionHandler = completionHandlerCaller.release()] (const ResourceRequest& request, WeakPtr<FormState>&& formState, const String& frameName, const NavigationAction& action, PolicyChecker::ShouldContinue shouldContinue) mutable {
Modified: trunk/Source/WebCore/loader/FrameLoader.h (260422 => 260423)
--- trunk/Source/WebCore/loader/FrameLoader.h 2020-04-21 10:28:37 UTC (rev 260422)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2020-04-21 10:31:08 UTC (rev 260423)
@@ -281,6 +281,7 @@
FrameLoaderStateMachine& stateMachine() { return m_stateMachine; }
+ // FIXME: should return RefPtr.
WEBCORE_EXPORT Frame* findFrameForNavigation(const AtomString& name, Document* activeDocument = nullptr);
void applyUserAgentIfNeeded(ResourceRequest&);