Cleanup FrameLoadRequest
https://bugs.webkit.org/show_bug.cgi?id=173564
<rdar://problem/32903570>

Reviewed by Brent Fulgham.

Source/WebCore:

FrameLoadRequest has too many constructors. Use default values to reduce the number of
constructors. Have FrameLoadRequest hold a Ref<SecurityOrigin> instead of a RefPtr<SecurityOrigin>
as FrameLoadRequest must always hold a valid SecurityOrigin, the security origin of the
document that initiated the request.

* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::openInNewTab): Explicitly pass the null-string for
the target frame name as we do not have one. Use C++11 brace initialization syntax and ASCIILiteral().
Rename local variable from request to frameLoadRequest to better describe its purpose. Fix up
FIXME comment added in r105600 to better describe the issue we should fix as the code as
changed since the FIXME was added.
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::navigate): No need to pass ShouldReplaceDocumentIfJavaScriptURL::ReplaceDocumentIfJavaScriptURL
now that the FrameLoadRequests constructor uses this policy by default. Use C++11 brace
initialization syntax and ASCIILiteral(). Rename local variable from frameRequest to frameLoadRequest
to better describe its purpose.
* loader/FrameLoadRequest.cpp:
(WebCore::FrameLoadRequest::FrameLoadRequest): Use C++11 brace initialization syntax.
* loader/FrameLoadRequest.h: Remove many constructor overloads. Changed m_requester from
RefPtr<SecurityOrigin> to Ref<SecurityOrigin> as we can never be instantiated with a null
SecurityOrigin. Moved m_shouldCheckNewWindowPolicy to be under ShouldOpenExternalURLsPolicy
to reduce the size of the class by 8 bytes.
* loader/FrameLoadRequest.h:
(WebCore::FrameLoadRequest::FrameLoadRequest): Added copy constructor as we must use Ref::copyRef()
to copy the Ref<SecurityOrigin>.
(WebCore::FrameLoadRequest::requester): Return a const SecurityOrigin& instead of a const SecurityOrigin*.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::urlSelected): Update now that the order of the ShouldReplaceDocumentIfJavaScriptURL
and ShouldOpenExternalURLsPolicy arguments in the FrameLoadRequest constructor has changed.
(WebCore::FrameLoader::loadURLIntoChildFrame): Ditto. Also use C++11 brace initialization syntax
and ASCIILiteral().
(WebCore::FrameLoader::loadFrameRequest): Update code now that FrameLoadRequest::requester() returns a
SecurityOrigin& instead of a SecurityOrigin*. Use C++11 brace initialization syntax.
* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::scheduleLocationChange): Use C++11 brace initialization syntax.
Rename local variable from frameRequest to frameLoadRequest to better describe its purpose.
* page/ContextMenuController.cpp:
(WebCore::openNewWindow):
(WebCore::ContextMenuController::contextMenuItemSelected): ove FrameLoadRequest instantiation
into a local variable and use C++11 brace initialization syntax to make it easier to identify
the arguments passed to FrameLoader::loadFrameRequest().
* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow): Update now that the order of the ShouldReplaceDocumentIfJavaScriptURL
and ShouldOpenExternalURLsPolicy arguments in the FrameLoadRequest constructor has changed.
Use C++11 brace initialization syntax and ASCIILiteral(). Rename some local variables to better
describe their purpose.

Source/WebKit/ios:

Move FrameLoadRequest instantiation into a local variable and use C++11 brace initialization
syntax to make it easier to identify the arguments passed to FrameLoader::loadFrameRequest().

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

Source/WebKit/mac:

* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]): Move FrameLoadRequest instantiation
into a local variable and use C++11 brace initialization syntax to make it easier to identify
the arguments passed to FrameLoader::loadFrameRequest().

Source/WebKit/win:

* Plugins/PluginView.cpp:
(WebCore::PluginView::start): Explicitly pass an empty ResourceRequest (we populate it after
we instantiate the FrameLoadRequest) and pass the null-string for the target frame name as
we do not have one. Use C++11 brace initialization syntax.
(WebCore::PluginView::getURLNotify): Explicitly pass the null-string for the target frame
name as we do not have one. Use C++11 brace initialization syntax.
(WebCore::PluginView::getURL): Ditto.
(WebCore::PluginView::handlePost): Move instantiation of FrameLoadRequest from the top of the
function to closer to where it is actually used. Explicitly pass the null-string for the target
frame name as we do not have one. Use C++11 brace initialization syntax.

Source/WebKit2:

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::loadURL): Explicitly pass the null-string for the target frame
name as we do not have one. Use C++11 brace initialization syntax.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchCreatePage): Ditto.
* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::openInNewTab): It is no longer necessary to pass ReplaceDocumentIfJavaScriptURL
when instantiating the FrameLoadRequest as it defaults to this policy. Use C++11 brace initialization syntax.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@218649 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp
index e6c392e..be79324 100644
--- a/Source/WebCore/loader/NavigationScheduler.cpp
+++ b/Source/WebCore/loader/NavigationScheduler.cpp
@@ -266,9 +266,9 @@
         auto& requestingDocument = m_submission->state().sourceDocument();
         if (!requestingDocument.canNavigate(&frame))
             return;
-        FrameLoadRequest frameRequest(requestingDocument.securityOrigin(), lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs());
-        m_submission->populateFrameLoadRequest(frameRequest);
-        frame.loader().loadFrameRequest(frameRequest, m_submission->event(), &m_submission->state());
+        FrameLoadRequest frameLoadRequest { requestingDocument.securityOrigin(), { }, { }, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs() };
+        m_submission->populateFrameLoadRequest(frameLoadRequest);
+        frame.loader().loadFrameRequest(frameLoadRequest, m_submission->event(), &m_submission->state());
     }
 
     void didStartTimer(Frame& frame, Timer& timer) override
@@ -316,9 +316,9 @@
         SubstituteData replacementData(SharedBuffer::create(), m_originDocument.url(), replacementResponse, SubstituteData::SessionHistoryVisibility::Hidden);
 
         ResourceRequest resourceRequest(m_originDocument.url(), emptyString(), ReloadIgnoringCacheData);
-        FrameLoadRequest frameRequest(m_originDocument.securityOrigin(), resourceRequest, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs());
-        frameRequest.setSubstituteData(replacementData);
-        frame.loader().load(frameRequest);
+        FrameLoadRequest frameLoadRequest { m_originDocument.securityOrigin(), resourceRequest, { }, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs() };
+        frameLoadRequest.setSubstituteData(replacementData);
+        frame.loader().load(frameLoadRequest);
     }
 
 private:
@@ -414,9 +414,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)) {
-        ResourceRequest resourceRequest(m_frame.document()->completeURL(url), referrer, UseProtocolCachePolicy);
-        FrameLoadRequest frameRequest(securityOrigin, resourceRequest, "_self", lockHistory, lockBackForwardList, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, initiatingDocument.shouldOpenExternalURLsPolicyToPropagate());
-        loader.changeLocation(frameRequest);
+        ResourceRequest resourceRequest { m_frame.document()->completeURL(url), referrer, UseProtocolCachePolicy };
+        FrameLoadRequest frameLoadRequest { securityOrigin, resourceRequest, ASCIILiteral("_self"), lockHistory, lockBackForwardList, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, initiatingDocument.shouldOpenExternalURLsPolicyToPropagate() };
+        loader.changeLocation(frameLoadRequest);
         return;
     }