Consolidate most "frame load" arguments into FrameLoadRequest.
https://bugs.webkit.org/show_bug.cgi?id=144276

Reviewed by Alexey Proskuryakov.

Source/WebCore:

No new tests (No change in behavior).

This patch starts the long overdue process of wrangling the insane load methods in FrameLoader.

Humble beginnings of this long process:
- Put most of the various "frame load" arguments that are passed around within FrameLoader on FrameLoadRequest.
- Get rid of the "easy" constructors of FrameLoadRequest, forcing users to actually think about what they're doing.
- Change a private FrameLoader load method (urlSelected) to take a FrameLoadRequest instead of argument gobbledygook.
- Change a public FrameLoader load methods (changeLocation) to take a FrameLoadRequest instead of gobbledygook.

These cover the straightforward changes where it was easy to figure out what the values of the FrameLoadRequest
arguments were from these various call sites.

Further refactoring can be done in much smaller patches, handling fewer cases at a time. Little by little we will be
able to reduce the number of "load" methods on FrameLoader and make sure that they mainly only take a FrameLoadRequest
as an argument.

* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::openInNewTab):

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::navigate):

* loader/FrameLoadRequest.cpp:
(WebCore::FrameLoadRequest::FrameLoadRequest):
* loader/FrameLoadRequest.h:
(WebCore::FrameLoadRequest::FrameLoadRequest):
(WebCore::FrameLoadRequest::lockHistory):
(WebCore::FrameLoadRequest::lockBackForwardList):
(WebCore::FrameLoadRequest::shouldSendReferrer):
(WebCore::FrameLoadRequest::allowNavigationToInvalidURL):
(WebCore::FrameLoadRequest::newFrameOpenerPolicy):
(WebCore::FrameLoadRequest::shouldReplaceDocumentIfJavaScriptURL):

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::changeLocation):
(WebCore::FrameLoader::urlSelected):
(WebCore::FrameLoader::loadFrameRequest):
* loader/FrameLoader.h:

* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::scheduleLocationChange):

* page/ContextMenuController.cpp:
(WebCore::openNewWindow):
(WebCore::ContextMenuController::contextMenuItemSelected):

* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):

Source/WebKit/ios:

* WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):

Source/WebKit/mac:

* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):

Source/WebKit/win:

* Plugins/PluginView.cpp:
(WebCore::PluginView::start):
(WebCore::PluginView::getURLNotify):
(WebCore::PluginView::getURL):
(WebCore::PluginView::handlePost):

Source/WebKit2:

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::loadURL):

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchCreatePage):

* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::openInNewTab):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@183498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp
index 85c02c9..cf7bdab 100644
--- a/Source/WebCore/loader/NavigationScheduler.cpp
+++ b/Source/WebCore/loader/NavigationScheduler.cpp
@@ -110,7 +110,11 @@
     virtual void fire(Frame& frame) override
     {
         UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
-        frame.loader().changeLocation(m_securityOrigin.get(), m_url, m_referrer, lockHistory(), lockBackForwardList(), false);
+
+        ResourceRequest resourceRequest(m_url, m_referrer, UseProtocolCachePolicy);
+        FrameLoadRequest frameRequest(m_securityOrigin.get(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow);
+
+        frame.loader().changeLocation(frameRequest);
     }
 
     virtual void didStartTimer(Frame& frame, Timer& timer) override
@@ -165,7 +169,10 @@
     {
         UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
         bool refresh = equalIgnoringFragmentIdentifier(frame.document()->url(), url());
-        frame.loader().changeLocation(securityOrigin(), url(), referrer(), lockHistory(), lockBackForwardList(), refresh, AllowNavigationToInvalidURL::No);
+        ResourceRequest resourceRequest(url(), referrer(), refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy);
+        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow);
+
+        frame.loader().changeLocation(frameRequest);
     }
 };
 
@@ -177,7 +184,10 @@
     virtual void fire(Frame& frame) override
     {
         UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
-        frame.loader().changeLocation(securityOrigin(), url(), referrer(), lockHistory(), lockBackForwardList(), false, AllowNavigationToInvalidURL::No);
+
+        ResourceRequest resourceRequest(url(), referrer(), UseProtocolCachePolicy);
+        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow);
+        frame.loader().changeLocation(frameRequest);
     }
 };
 
@@ -191,7 +201,10 @@
     virtual void fire(Frame& frame) override
     {
         UserGestureIndicator gestureIndicator(wasUserGesture() ? DefinitelyProcessingUserGesture : DefinitelyNotProcessingUserGesture);
-        frame.loader().changeLocation(securityOrigin(), url(), referrer(), lockHistory(), lockBackForwardList(), true);
+
+        ResourceRequest resourceRequest(url(), referrer(), ReloadIgnoringCacheData);
+        FrameLoadRequest frameRequest(securityOrigin(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow);
+        frame.loader().changeLocation(frameRequest);
     }
 };
 
@@ -244,9 +257,9 @@
         Document* requestingDocument = m_submission->state()->sourceDocument();
         if (!requestingDocument->canNavigate(&frame))
             return;
-        FrameLoadRequest frameRequest(requestingDocument->securityOrigin());
+        FrameLoadRequest frameRequest(requestingDocument->securityOrigin(), lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow);
         m_submission->populateFrameLoadRequest(frameRequest);
-        frame.loader().loadFrameRequest(frameRequest, lockHistory(), lockBackForwardList(), m_submission->event(), m_submission->state(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow);
+        frame.loader().loadFrameRequest(frameRequest, m_submission->event(), m_submission->state());
     }
     
     virtual void didStartTimer(Frame& frame, Timer& timer) override
@@ -387,7 +400,9 @@
     // If the URL we're going to navigate to is the same as the current one, except for the
     // fragment part, we don't need to schedule the location change.
     if (url.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(m_frame.document()->url(), url)) {
-        loader.changeLocation(securityOrigin, m_frame.document()->completeURL(url), referrer, lockHistory, lockBackForwardList, false, AllowNavigationToInvalidURL::No);
+        ResourceRequest resourceRequest(m_frame.document()->completeURL(url), referrer, UseProtocolCachePolicy);
+        FrameLoadRequest frameRequest(securityOrigin, resourceRequest, emptyString(), lockHistory, lockBackForwardList, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL);
+        loader.changeLocation(frameRequest);
         return;
     }