Cleanup FrameLoadRequest
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jun 2017 21:19:05 +0000 (21:19 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jun 2017 21:19:05 +0000 (21:19 +0000)
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

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/loader/FrameLoadRequest.cpp
Source/WebCore/loader/FrameLoadRequest.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/NavigationScheduler.cpp
Source/WebCore/page/ContextMenuController.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/WebView/WebPDFViewPlaceholder.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPDFView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/Plugins/PluginView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/PluginView.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebPage/WebInspector.cpp

index 7d4e62b..745be8a 100644 (file)
@@ -1,3 +1,58 @@
+2017-06-21  Daniel Bates  <dabates@apple.com>
+
+        Cleanup FrameLoadRequest
+        https://bugs.webkit.org/show_bug.cgi?id=173564
+        <rdar://problem/32903570>
+
+        Reviewed by Brent Fulgham.
+
+        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.
+
 2017-06-20  Simon Fraser  <simon.fraser@apple.com>
 
         svgPath.getTotalLength() freezes webkit
index 755f760..29dcb1d 100644 (file)
@@ -225,23 +225,22 @@ void InspectorFrontendClientLocal::changeAttachedWindowWidth(unsigned width)
 
 void InspectorFrontendClientLocal::openInNewTab(const String& url)
 {
-    UserGestureIndicator indicator(ProcessingUserGesture);
+    UserGestureIndicator indicator { ProcessingUserGesture };
     Frame& mainFrame = m_inspectedPageController->inspectedPage().mainFrame();
-    FrameLoadRequest request(mainFrame.document()->securityOrigin(), ResourceRequest(), "_blank", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+    FrameLoadRequest frameLoadRequest { mainFrame.document()->securityOrigin(), ResourceRequest(), ASCIILiteral("_blank"), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
 
     bool created;
-    WindowFeatures windowFeatures;
-    RefPtr<Frame> frame = WebCore::createWindow(mainFrame, mainFrame, request, windowFeatures, created);
+    RefPtr<Frame> frame = WebCore::createWindow(mainFrame, mainFrame, frameLoadRequest, { }, created);
     if (!frame)
         return;
 
     frame->loader().setOpener(&mainFrame);
     frame->page()->setOpenedByDOM();
 
-    // FIXME: Why does one use mainFrame and the other frame?
-    ResourceRequest resourceRequest(frame->document()->completeURL(url));
-    FrameLoadRequest frameRequest(mainFrame.document()->securityOrigin(), resourceRequest, "_self", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
-    frame->loader().changeLocation(frameRequest);
+    // FIXME: Why do we compute the absolute URL with respect to |frame| instead of |mainFrame|?
+    ResourceRequest resourceRequest { frame->document()->completeURL(url) };
+    FrameLoadRequest frameLoadRequest2 { mainFrame.document()->securityOrigin(), resourceRequest, ASCIILiteral("_self"), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+    frame->loader().changeLocation(frameLoadRequest2);
 }
 
 void InspectorFrontendClientLocal::moveWindowBy(float x, float y)
index e4eacaa..cc3be3f 100644 (file)
@@ -419,12 +419,12 @@ void InspectorPageAgent::reload(ErrorString&, const bool* const optionalIgnoreCa
 
 void InspectorPageAgent::navigate(ErrorString&, const String& url)
 {
-    UserGestureIndicator indicator(ProcessingUserGesture);
+    UserGestureIndicator indicator { ProcessingUserGesture };
     Frame& frame = m_page.mainFrame();
 
-    ResourceRequest resourceRequest(frame.document()->completeURL(url));
-    FrameLoadRequest frameRequest(frame.document()->securityOrigin(), resourceRequest, "_self", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldReplaceDocumentIfJavaScriptURL::ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
-    frame.loader().changeLocation(frameRequest);
+    ResourceRequest resourceRequest { frame.document()->completeURL(url) };
+    FrameLoadRequest frameLoadRequest { frame.document()->securityOrigin(), resourceRequest, ASCIILiteral("_self"), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+    frame.loader().changeLocation(frameLoadRequest);
 }
 
 static Ref<Inspector::Protocol::Page::Cookie> buildObjectForCookie(const Cookie& cookie)
index 7d2bd3b..a2d20aa 100644 (file)
@@ -37,9 +37,8 @@
 namespace WebCore {
 
 FrameLoadRequest::FrameLoadRequest(Frame& frame, const ResourceRequest& resourceRequest, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, const SubstituteData& substituteData)
-    : m_requester { &frame.document()->securityOrigin() }
+    : m_requester { makeRef(frame.document()->securityOrigin()) }
     , m_resourceRequest { resourceRequest }
-    , m_shouldCheckNewWindowPolicy { false }
     , m_substituteData { substituteData }
     , m_lockHistory { LockHistory::No }
     , m_lockBackForwardList { LockBackForwardList::No }
index 2e6e308..bdb73e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -35,79 +35,42 @@ class Frame;
 
 struct FrameLoadRequest {
 public:
-    FrameLoadRequest(SecurityOrigin& requester, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
-        : m_requester(&requester)
-        , m_lockHistory(lockHistory)
-        , m_lockBackForwardList(lockBackForwardList)
-        , m_shouldSendReferrer(shouldSendReferrer)
-        , m_allowNavigationToInvalidURL(allowNavigationToInvalidURL)
-        , m_newFrameOpenerPolicy(newFrameOpenerPolicy)
-        , m_shouldReplaceDocumentIfJavaScriptURL(ReplaceDocumentIfJavaScriptURL)
-        , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
-    {
-    }
-
-    FrameLoadRequest(SecurityOrigin& requester, const ResourceRequest& resourceRequest, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
-        : m_requester(&requester)
-        , m_resourceRequest(resourceRequest)
-        , m_lockHistory(lockHistory)
-        , m_lockBackForwardList(lockBackForwardList)
-        , m_shouldSendReferrer(shouldSendReferrer)
-        , m_allowNavigationToInvalidURL(allowNavigationToInvalidURL)
-        , m_newFrameOpenerPolicy(newFrameOpenerPolicy)
-        , m_shouldReplaceDocumentIfJavaScriptURL(ReplaceDocumentIfJavaScriptURL)
-        , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
-    {
-    }
-
-    FrameLoadRequest(SecurityOrigin& requester, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
-        : m_requester(&requester)
-        , m_resourceRequest(resourceRequest)
-        , m_frameName(frameName)
-        , m_lockHistory(lockHistory)
-        , m_lockBackForwardList(lockBackForwardList)
-        , m_shouldSendReferrer(shouldSendReferrer)
-        , m_allowNavigationToInvalidURL(allowNavigationToInvalidURL)
-        , m_newFrameOpenerPolicy(newFrameOpenerPolicy)
-        , m_shouldReplaceDocumentIfJavaScriptURL(ReplaceDocumentIfJavaScriptURL)
-        , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
-    {
-    }
-
-    FrameLoadRequest(SecurityOrigin& requester, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
-        : m_requester(&requester)
-        , m_resourceRequest(resourceRequest)
-        , m_frameName(frameName)
-        , m_lockHistory(lockHistory)
-        , m_lockBackForwardList(lockBackForwardList)
-        , m_shouldSendReferrer(shouldSendReferrer)
-        , m_allowNavigationToInvalidURL(allowNavigationToInvalidURL)
-        , m_newFrameOpenerPolicy(newFrameOpenerPolicy)
-        , m_shouldReplaceDocumentIfJavaScriptURL(shouldReplaceDocumentIfJavaScriptURL)
-        , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
+    FrameLoadRequest(SecurityOrigin& requester, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL, const AtomicString& downloadAttribute = { })
+        : m_requester { makeRef(requester) }
+        , m_resourceRequest { resourceRequest }
+        , m_frameName { frameName }
+        , m_lockHistory { lockHistory }
+        , m_lockBackForwardList { lockBackForwardList }
+        , m_shouldSendReferrer { shouldSendReferrer }
+        , m_allowNavigationToInvalidURL { allowNavigationToInvalidURL }
+        , m_newFrameOpenerPolicy { newFrameOpenerPolicy }
+        , m_shouldReplaceDocumentIfJavaScriptURL { shouldReplaceDocumentIfJavaScriptURL }
+        , m_shouldOpenExternalURLsPolicy { shouldOpenExternalURLsPolicy }
+        , m_downloadAttribute { downloadAttribute }
     {
     }
+    WEBCORE_EXPORT FrameLoadRequest(Frame&, const ResourceRequest&, ShouldOpenExternalURLsPolicy, const SubstituteData& = SubstituteData());
 
-    FrameLoadRequest(SecurityOrigin& requester, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, const AtomicString& downloadAttribute)
-        : m_requester(&requester)
-        , m_resourceRequest(resourceRequest)
-        , m_frameName(frameName)
-        , m_lockHistory(lockHistory)
-        , m_lockBackForwardList(lockBackForwardList)
-        , m_shouldSendReferrer(shouldSendReferrer)
-        , m_allowNavigationToInvalidURL(allowNavigationToInvalidURL)
-        , m_newFrameOpenerPolicy(newFrameOpenerPolicy)
-        , m_shouldReplaceDocumentIfJavaScriptURL(shouldReplaceDocumentIfJavaScriptURL)
-        , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
-        , m_downloadAttribute(downloadAttribute)
+    FrameLoadRequest(const FrameLoadRequest& other)
+        : m_requester { other.m_requester.copyRef() }
+        , m_resourceRequest { other.m_resourceRequest }
+        , m_frameName { other.m_frameName }
+        , m_substituteData { other.m_substituteData }
+        , m_shouldCheckNewWindowPolicy { other.m_shouldCheckNewWindowPolicy }
+        , m_lockHistory { other.m_lockHistory }
+        , m_lockBackForwardList { other.m_lockBackForwardList }
+        , m_shouldSendReferrer { other.m_shouldSendReferrer }
+        , m_allowNavigationToInvalidURL { other.m_allowNavigationToInvalidURL }
+        , m_newFrameOpenerPolicy { other.m_newFrameOpenerPolicy }
+        , m_shouldReplaceDocumentIfJavaScriptURL { other.m_shouldReplaceDocumentIfJavaScriptURL }
+        , m_shouldOpenExternalURLsPolicy { other.m_shouldOpenExternalURLsPolicy }
+        , m_downloadAttribute { other.m_downloadAttribute }
     {
     }
 
-    WEBCORE_EXPORT FrameLoadRequest(Frame&, const ResourceRequest&, ShouldOpenExternalURLsPolicy, const SubstituteData& = SubstituteData());
-
     bool isEmpty() const { return m_resourceRequest.isEmpty(); }
 
-    const SecurityOrigin* requester() const { return m_requester.get(); }
+    const SecurityOrigin& requester() const { return m_requester.get(); }
 
     ResourceRequest& resourceRequest() { return m_resourceRequest; }
     const ResourceRequest& resourceRequest() const { return m_resourceRequest; }
@@ -138,12 +101,12 @@ public:
     const AtomicString& downloadAttribute() const { return m_downloadAttribute; }
 
 private:
-    RefPtr<SecurityOrigin> m_requester;
+    Ref<SecurityOrigin> m_requester;
     ResourceRequest m_resourceRequest;
     String m_frameName;
-    bool m_shouldCheckNewWindowPolicy { false };
     SubstituteData m_substituteData;
 
+    bool m_shouldCheckNewWindowPolicy { false };
     LockHistory m_lockHistory;
     LockBackForwardList m_lockBackForwardList;
     ShouldSendReferrer m_shouldSendReferrer;
index 958380b..b410894 100644 (file)
@@ -362,7 +362,7 @@ void FrameLoader::changeLocation(const FrameLoadRequest& request)
 void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, std::optional<NewFrameOpenerPolicy> openerPolicy, const AtomicString& downloadAttribute)
 {
     NewFrameOpenerPolicy newFrameOpenerPolicy = openerPolicy.value_or(shouldSendReferrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerPolicy::Allow);
-    urlSelected(FrameLoadRequest(m_frame.document()->securityOrigin(), ResourceRequest(url), passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, DoNotReplaceDocumentIfJavaScriptURL, shouldOpenExternalURLsPolicy, downloadAttribute), triggeringEvent);
+    urlSelected(FrameLoadRequest(m_frame.document()->securityOrigin(), ResourceRequest(url), passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute), triggeringEvent);
 }
 
 void FrameLoader::urlSelected(const FrameLoadRequest& passedRequest, Event* triggeringEvent)
@@ -923,7 +923,7 @@ void FrameLoader::loadURLIntoChildFrame(const URL& url, const String& referer, F
         }
     }
 
-    FrameLoadRequest frameLoadRequest(m_frame.document()->securityOrigin(), ResourceRequest(url), "_self", LockHistory::No, LockBackForwardList::Yes, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+    FrameLoadRequest frameLoadRequest { m_frame.document()->securityOrigin(), { url }, ASCIILiteral("_self"), LockHistory::No, LockBackForwardList::Yes, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
     childFrame->loader().loadURL(frameLoadRequest, referer, FrameLoadType::RedirectWithLockedBackForwardList, 0, 0);
 }
 
@@ -1165,7 +1165,7 @@ void FrameLoader::loadFrameRequest(const FrameLoadRequest& request, Event* event
     URL url = request.resourceRequest().url();
 
     ASSERT(m_frame.document());
-    if (!request.requester()->canDisplay(url)) {
+    if (!request.requester().canDisplay(url)) {
         reportLocalLoadFailed(&m_frame, url.stringCenterEllipsizedToLength());
         return;
     }
index e6c392e..be79324 100644 (file)
@@ -266,9 +266,9 @@ public:
         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 @@ public:
         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 @@ void NavigationScheduler::scheduleLocationChange(Document& initiatingDocument, S
     // 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;
     }
 
index 68b12eb..4d99ea1 100644 (file)
@@ -189,13 +189,13 @@ static void openNewWindow(const URL& urlToLoad, Frame& frame, ShouldOpenExternal
     if (!oldPage)
         return;
 
-    FrameLoadRequest request(frame.document()->securityOrigin(), ResourceRequest(urlToLoad, frame.loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, shouldOpenExternalURLsPolicy);
+    FrameLoadRequest frameLoadRequest { frame.document()->securityOrigin(), ResourceRequest(urlToLoad, frame.loader().outgoingReferrer()), { }, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, shouldOpenExternalURLsPolicy };
 
-    Page* newPage = oldPage->chrome().createWindow(frame, request, WindowFeatures(), NavigationAction(request.resourceRequest()));
+    Page* newPage = oldPage->chrome().createWindow(frame, frameLoadRequest, { }, NavigationAction(frameLoadRequest.resourceRequest()));
     if (!newPage)
         return;
     newPage->chrome().show();
-    newPage->mainFrame().loader().loadFrameRequest(request, nullptr, nullptr);
+    newPage->mainFrame().loader().loadFrameRequest(frameLoadRequest, nullptr, nullptr);
 }
 
 #if PLATFORM(GTK)
@@ -393,9 +393,11 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuAction action, co
         m_client.lookUpInDictionary(frame);
         break;
     case ContextMenuItemTagOpenLink:
-        if (Frame* targetFrame = m_context.hitTestResult().targetFrame())
-            targetFrame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer()), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, targetFrame->isMainFrame() ? ShouldOpenExternalURLsPolicy::ShouldAllow : ShouldOpenExternalURLsPolicy::ShouldNotAllow), nullptr, nullptr);
-        else
+        if (Frame* targetFrame = m_context.hitTestResult().targetFrame()) {
+            ResourceRequest resourceRequest { m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer() };
+            FrameLoadRequest frameLoadRequest { frame->document()->securityOrigin(), resourceRequest, { }, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, targetFrame->isMainFrame() ? ShouldOpenExternalURLsPolicy::ShouldAllow : ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+            targetFrame->loader().loadFrameRequest(frameLoadRequest, nullptr, nullptr);
+        } else
             openNewWindow(m_context.hitTestResult().absoluteLinkURL(), *frame, ShouldOpenExternalURLsPolicy::ShouldAllow);
         break;
     case ContextMenuItemTagBold:
index b500f1f..20b3200 100644 (file)
@@ -2197,14 +2197,14 @@ RefPtr<Frame> DOMWindow::createWindow(const String& urlString, const AtomicStrin
     // For whatever reason, Firefox uses the first frame to determine the outgoingReferrer. We replicate that behavior here.
     String referrer = SecurityPolicy::generateReferrerHeader(firstFrame.document()->referrerPolicy(), completedURL, firstFrame.loader().outgoingReferrer());
 
-    ResourceRequest request(completedURL, referrer);
-    FrameLoader::addHTTPOriginIfNeeded(request, firstFrame.loader().outgoingOrigin());
-    FrameLoadRequest frameRequest(activeDocument->securityOrigin(), request, frameName, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, activeDocument->shouldOpenExternalURLsPolicyToPropagate());
+    ResourceRequest resourceRequest { completedURL, referrer };
+    FrameLoader::addHTTPOriginIfNeeded(resourceRequest, firstFrame.loader().outgoingOrigin());
+    FrameLoadRequest frameLoadRequest { activeDocument->securityOrigin(), resourceRequest, frameName, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, activeDocument->shouldOpenExternalURLsPolicyToPropagate() };
 
     // We pass the opener frame for the lookupFrame in case the active frame is different from
     // the opener frame, and the name references a frame relative to the opener frame.
     bool created;
-    RefPtr<Frame> newFrame = WebCore::createWindow(*activeFrame, openerFrame, frameRequest, windowFeatures, created);
+    RefPtr<Frame> newFrame = WebCore::createWindow(*activeFrame, openerFrame, frameLoadRequest, windowFeatures, created);
     if (!newFrame)
         return nullptr;
 
@@ -2219,9 +2219,9 @@ RefPtr<Frame> DOMWindow::createWindow(const String& urlString, const AtomicStrin
         prepareDialogFunction(*newFrame->document()->domWindow());
 
     if (created) {
-        ResourceRequest resourceRequest(completedURL, referrer, UseProtocolCachePolicy);
-        FrameLoadRequest frameRequest(activeWindow.document()->securityOrigin(), resourceRequest, "_self", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, activeDocument->shouldOpenExternalURLsPolicyToPropagate());
-        newFrame->loader().changeLocation(frameRequest);
+        ResourceRequest resourceRequest { completedURL, referrer, UseProtocolCachePolicy };
+        FrameLoadRequest frameLoadRequest { activeWindow.document()->securityOrigin(), resourceRequest, ASCIILiteral("_self"), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, activeDocument->shouldOpenExternalURLsPolicyToPropagate() };
+        newFrame->loader().changeLocation(frameLoadRequest);
     } else if (!urlString.isEmpty()) {
         LockHistory lockHistory = ScriptController::processingUserGesture() ? LockHistory::No : LockHistory::Yes;
         newFrame->navigationScheduler().scheduleLocationChange(*activeWindow.document(), activeWindow.document()->securityOrigin(), completedURL, referrer, lockHistory, LockBackForwardList::No);
index a4d4b94..4095901 100644 (file)
@@ -1,3 +1,17 @@
+2017-06-21  Daniel Bates  <dabates@apple.com>
+
+        Cleanup FrameLoadRequest
+        https://bugs.webkit.org/show_bug.cgi?id=173564
+        <rdar://problem/32903570>
+
+        Reviewed by Brent Fulgham.
+
+        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:]):
+
 2017-06-09  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS DnD] Add a hook to perform two-step drops in editable content
index cddc61c..e8c4783 100644 (file)
@@ -487,7 +487,8 @@ static const float PAGE_HEIGHT_INSET = 4.0f * 2.0f;
 
     // Call to the frame loader because this is where our security checks are made.
     Frame* frame = core([_dataSource webFrame]);
-    frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(URL), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow), event.get(), nullptr);
+    FrameLoadRequest frameLoadRequest { frame->document()->securityOrigin(), { URL }, { }, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+    frame->loader().loadFrameRequest(frameLoadRequest, event.get(), nullptr);
 }
 
 @end
index daa9c48..547888b 100644 (file)
@@ -1,3 +1,16 @@
+2017-06-21  Daniel Bates  <dabates@apple.com>
+
+        Cleanup FrameLoadRequest
+        https://bugs.webkit.org/show_bug.cgi?id=173564
+        <rdar://problem/32903570>
+
+        Reviewed by Brent Fulgham.
+
+        * 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().
+
 2017-06-21  Antoine Quint  <graouts@apple.com>
 
         Add logging to identify when the Page suspends scripted animations
index a7330e1..29e2bf4 100644 (file)
@@ -1038,7 +1038,8 @@ static BOOL isFrameInRange(WebFrame *frame, DOMRange *range)
 
     // Call to the frame loader because this is where our security checks are made.
     Frame* frame = core([dataSource webFrame]);
-    frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(URL), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow), event.get(), nullptr);
+    FrameLoadRequest frameLoadRequest { frame->document()->securityOrigin(), { URL }, { }, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+    frame->loader().loadFrameRequest(frameLoadRequest, event.get(), nullptr);
 }
 
 - (void)PDFViewOpenPDFInNativeApplication:(PDFView *)sender
index bab880e..a2ed1ba 100644 (file)
@@ -1,3 +1,22 @@
+2017-06-21  Daniel Bates  <dabates@apple.com>
+
+        Cleanup FrameLoadRequest
+        https://bugs.webkit.org/show_bug.cgi?id=173564
+        <rdar://problem/32903570>
+
+        Reviewed by Brent Fulgham.
+
+        * 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.
+
 2017-06-20  Daniel Bates  <dabates@apple.com>
 
         Have FrameLoadRequest takes a Frame& instead of a Frame*
index 66cfee2..e3fa0bf 100644 (file)
@@ -255,7 +255,7 @@ bool PluginView::start()
     m_isStarted = true;
 
     if (!m_url.isEmpty() && !m_loadManually) {
-        FrameLoadRequest frameLoadRequest(m_parentFrame->document()->securityOrigin(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+        FrameLoadRequest frameLoadRequest { m_parentFrame->document()->securityOrigin(), { }, { }, LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
         frameLoadRequest.resourceRequest().setHTTPMethod("GET");
         frameLoadRequest.resourceRequest().setURL(m_url);
         load(frameLoadRequest, false, 0);
@@ -534,9 +534,8 @@ static URL makeURL(const URL& baseURL, const char* relativeURLString)
 
 NPError PluginView::getURLNotify(const char* url, const char* target, void* notifyData)
 {
-    FrameLoadRequest frameLoadRequest(m_parentFrame->document()->securityOrigin(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+    FrameLoadRequest frameLoadRequest { m_parentFrame->document()->securityOrigin(), { }, target, LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
 
-    frameLoadRequest.setFrameName(target);
     frameLoadRequest.resourceRequest().setHTTPMethod("GET");
     frameLoadRequest.resourceRequest().setURL(makeURL(m_parentFrame->document()->baseURL(), url));
 
@@ -545,9 +544,8 @@ NPError PluginView::getURLNotify(const char* url, const char* target, void* noti
 
 NPError PluginView::getURL(const char* url, const char* target)
 {
-    FrameLoadRequest frameLoadRequest(m_parentFrame->document()->securityOrigin(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+    FrameLoadRequest frameLoadRequest { m_parentFrame->document()->securityOrigin(), { }, target, LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
 
-    frameLoadRequest.setFrameName(target);
     frameLoadRequest.resourceRequest().setHTTPMethod("GET");
     frameLoadRequest.resourceRequest().setURL(makeURL(m_parentFrame->document()->baseURL(), url));
 
@@ -1048,8 +1046,6 @@ NPError PluginView::handlePost(const char* url, const char* target, uint32_t len
     if (!url || !len || !buf)
         return NPERR_INVALID_PARAM;
 
-    FrameLoadRequest frameLoadRequest(m_parentFrame->document()->securityOrigin(), LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
-
     HTTPHeaderMap headerFields;
     Vector<char> buffer;
     
@@ -1091,11 +1087,11 @@ NPError PluginView::handlePost(const char* url, const char* target, uint32_t len
         }
     }
 
+    FrameLoadRequest frameLoadRequest { m_parentFrame->document()->securityOrigin(), { }, target, LockHistory::No, LockBackForwardList::No, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
     frameLoadRequest.resourceRequest().setHTTPMethod("POST");
     frameLoadRequest.resourceRequest().setURL(makeURL(m_parentFrame->document()->baseURL(), url));
     frameLoadRequest.resourceRequest().setHTTPHeaderFields(WTFMove(headerFields));
     frameLoadRequest.resourceRequest().setHTTPBody(FormData::create(postData, postDataLength));
-    frameLoadRequest.setFrameName(target);
 
     return load(frameLoadRequest, sendNotification, notifyData);
 }
index 42ee6b9..5dd49e6 100644 (file)
@@ -1,3 +1,20 @@
+2017-06-21  Daniel Bates  <dabates@apple.com>
+
+        Cleanup FrameLoadRequest
+        https://bugs.webkit.org/show_bug.cgi?id=173564
+        <rdar://problem/32903570>
+
+        Reviewed by Brent Fulgham.
+
+        * 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.
+
 2017-06-21  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS DnD] [WK2] Add drag-and-drop release logging around WKContentView
index 62d6c55..e8e1e8c 100644 (file)
@@ -1388,7 +1388,7 @@ String PluginView::userAgent()
 
 void PluginView::loadURL(uint64_t requestID, const String& method, const String& urlString, const String& target, const HTTPHeaderMap& headerFields, const Vector<uint8_t>& httpBody, bool allowPopups)
 {
-    FrameLoadRequest frameLoadRequest(m_pluginElement->document().securityOrigin(), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+    FrameLoadRequest frameLoadRequest { m_pluginElement->document().securityOrigin(), { }, target, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
     frameLoadRequest.resourceRequest().setHTTPMethod(method);
     frameLoadRequest.resourceRequest().setURL(m_pluginElement->document().completeURL(urlString));
     frameLoadRequest.resourceRequest().setHTTPHeaderFields(headerFields);
@@ -1398,8 +1398,6 @@ void PluginView::loadURL(uint64_t requestID, const String& method, const String&
             frameLoadRequest.resourceRequest().setHTTPContentType("application/x-www-form-urlencoded");
     }
 
-    frameLoadRequest.setFrameName(target);
-
     String referrer = SecurityPolicy::generateReferrerHeader(frame()->document()->referrerPolicy(), frameLoadRequest.resourceRequest().url(), frame()->loader().outgoingReferrer());
     if (!referrer.isEmpty())
         frameLoadRequest.resourceRequest().setHTTPReferrer(referrer);
index 8864649..db94c3f 100644 (file)
@@ -657,8 +657,8 @@ Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction& navigati
         return nullptr;
 
     // Just call through to the chrome client.
-    FrameLoadRequest request(m_frame->coreFrame()->document()->securityOrigin(), navigationAction.resourceRequest(), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, navigationAction.shouldOpenExternalURLsPolicy());
-    Page* newPage = webPage->corePage()->chrome().createWindow(*m_frame->coreFrame(), request, WindowFeatures(), navigationAction);
+    FrameLoadRequest frameLoadRequest { m_frame->coreFrame()->document()->securityOrigin(), navigationAction.resourceRequest(), { }, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, navigationAction.shouldOpenExternalURLsPolicy() };
+    Page* newPage = webPage->corePage()->chrome().createWindow(*m_frame->coreFrame(), frameLoadRequest, { }, navigationAction);
     if (!newPage)
         return nullptr;
     
index 50caaa4..dc07d11 100644 (file)
@@ -146,13 +146,13 @@ void WebInspector::openInNewTab(const String& urlString)
         return;
 
     Frame& inspectedMainFrame = inspectedPage->mainFrame();
-    FrameLoadRequest request(inspectedMainFrame.document()->securityOrigin(), ResourceRequest(urlString), "_blank", LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy::ShouldNotAllow);
+    FrameLoadRequest frameLoadRequest { inspectedMainFrame.document()->securityOrigin(), { urlString }, ASCIILiteral("_blank"), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, ShouldOpenExternalURLsPolicy::ShouldNotAllow };
 
-    Page* newPage = inspectedPage->chrome().createWindow(inspectedMainFrame, request, WindowFeatures(), NavigationAction(request.resourceRequest(), NavigationType::LinkClicked));
+    Page* newPage = inspectedPage->chrome().createWindow(inspectedMainFrame, frameLoadRequest, { }, NavigationAction(frameLoadRequest.resourceRequest(), NavigationType::LinkClicked));
     if (!newPage)
         return;
 
-    newPage->mainFrame().loader().load(request);
+    newPage->mainFrame().loader().load(frameLoadRequest);
 }
 
 void WebInspector::evaluateScriptForTest(const String& script)