Add referrerpolicy attribute support for anchors
https://bugs.webkit.org/show_bug.cgi?id=208424
Patch by Rob Buis <rbuis@igalia.com> on 2020-03-02
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
Update improved test results.
* web-platform-tests/html/dom/idlharness.https-expected.txt:
* web-platform-tests/html/dom/reflection-text-expected.txt:
Source/WebCore:
This patch adds 'referrerpolicy' attribute support for anchor elements.
If set, the value is restricted to the ReferrerPolicy enum, and
if valid it is used for the script fetch.
If not set or invalid, the current behavior is kept.
Tests: http/tests/referrer-policy-anchor/no-referrer-when-downgrade/cross-origin-http-http.html
http/tests/referrer-policy-anchor/no-referrer-when-downgrade/cross-origin-http.https.html
http/tests/referrer-policy-anchor/no-referrer-when-downgrade/same-origin.html
http/tests/referrer-policy-anchor/no-referrer/cross-origin-http-http.html
http/tests/referrer-policy-anchor/no-referrer/cross-origin-http.https.html
http/tests/referrer-policy-anchor/no-referrer/same-origin.html
http/tests/referrer-policy-anchor/origin-when-cross-origin/cross-origin-http-http.html
http/tests/referrer-policy-anchor/origin-when-cross-origin/cross-origin-http.https.html
http/tests/referrer-policy-anchor/origin-when-cross-origin/same-origin.html
http/tests/referrer-policy-anchor/origin/cross-origin-http-http.html
http/tests/referrer-policy-anchor/origin/cross-origin-http.https.html
http/tests/referrer-policy-anchor/origin/same-origin.html
http/tests/referrer-policy-anchor/same-origin/cross-origin-http-http.html
http/tests/referrer-policy-anchor/same-origin/cross-origin-http.https.html
http/tests/referrer-policy-anchor/same-origin/same-origin.html
http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/cross-origin-http-http.html
http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/cross-origin-http.https.html
http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/same-origin.html
http/tests/referrer-policy-anchor/strict-origin/cross-origin-http-http.html
http/tests/referrer-policy-anchor/strict-origin/cross-origin-http.https.html
http/tests/referrer-policy-anchor/strict-origin/same-origin.html
http/tests/referrer-policy-anchor/unsafe-url/cross-origin-http-http.html
http/tests/referrer-policy-anchor/unsafe-url/cross-origin-http.https.html
http/tests/referrer-policy-anchor/unsafe-url/same-origin.html
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::handleClick):
(WebCore::HTMLAnchorElement::setReferrerPolicyForBindings):
(WebCore::HTMLAnchorElement::referrerPolicyForBindings const):
(WebCore::HTMLAnchorElement::referrerPolicy const):
* html/HTMLAnchorElement.h:
* html/HTMLAnchorElement.idl:
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::handleClick):
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::openInNewTab):
* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::navigate):
* loader/FrameLoadRequest.cpp:
(WebCore::FrameLoadRequest::FrameLoadRequest):
* loader/FrameLoadRequest.h:
(WebCore::FrameLoadRequest::FrameLoadRequest):
(WebCore::FrameLoadRequest::referrerPolicy const):
(WebCore::FrameLoadRequest::shouldSendReferrer const): Deleted.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::urlSelected):
(WebCore::FrameLoader::loadURLIntoChildFrame):
(WebCore::FrameLoader::loadFrameRequest):
* loader/FrameLoader.h:
* loader/FrameLoaderTypes.h:
* loader/NavigationScheduler.cpp:
(WebCore::NavigationScheduler::scheduleLocationChange):
* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::defaultEventHandler):
* page/ContextMenuController.cpp:
(WebCore::openNewWindow):
(WebCore::ContextMenuController::contextMenuItemSelected):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::defaultEventHandler):
Source/WebKit:
Adjust to FrameLoadRequest API change.
* WebProcess/Inspector/WebInspector.cpp:
(WebKit::WebInspector::openInNewTab):
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::clickedLink):
* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::loadURL):
* WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::searchWithGoogle):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchCreatePage):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::navigateToPDFLinkWithSimulatedClick):
Source/WebKitLegacy/ios:
Adjust to FrameLoadRequest API change.
* WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder simulateClickOnLinkToURL:]):
Source/WebKitLegacy/mac:
Adjust to FrameLoadRequest API change.
* WebView/WebPDFView.mm:
(-[WebPDFView PDFViewWillClickOnLink:withURL:]):
Source/WebKitLegacy/win:
Adjust to FrameLoadRequest API change.
* Plugins/PluginView.cpp:
(WebCore::PluginView::start):
(WebCore::PluginView::getURLNotify):
(WebCore::PluginView::getURL):
(WebCore::PluginView::handlePost):
* WebCoreSupport/WebContextMenuClient.cpp:
(WebContextMenuClient::searchWithGoogle):
LayoutTests:
Add tests for anchors with various referrerpolicy attribute values and
update improved test results.
* http/tests/referrer-policy-anchor/no-referrer-when-downgrade/cross-origin-http-http-expected.txt: Added.
* http/tests/referrer-policy-anchor/no-referrer-when-downgrade/cross-origin-http-http.html: Added.
* http/tests/referrer-policy-anchor/no-referrer-when-downgrade/cross-origin-http.https-expected.txt: Added.
* http/tests/referrer-policy-anchor/no-referrer-when-downgrade/cross-origin-http.https.html: Added.
* http/tests/referrer-policy-anchor/no-referrer-when-downgrade/same-origin-expected.txt: Added.
* http/tests/referrer-policy-anchor/no-referrer-when-downgrade/same-origin.html: Added.
* http/tests/referrer-policy-anchor/no-referrer/cross-origin-http-http-expected.txt: Added.
* http/tests/referrer-policy-anchor/no-referrer/cross-origin-http-http.html: Added.
* http/tests/referrer-policy-anchor/no-referrer/cross-origin-http.https-expected.txt: Added.
* http/tests/referrer-policy-anchor/no-referrer/cross-origin-http.https.html: Added.
* http/tests/referrer-policy-anchor/no-referrer/same-origin-expected.txt: Added.
* http/tests/referrer-policy-anchor/no-referrer/same-origin.html: Added.
* http/tests/referrer-policy-anchor/origin-when-cross-origin/cross-origin-http-http-expected.txt: Added.
* http/tests/referrer-policy-anchor/origin-when-cross-origin/cross-origin-http-http.html: Added.
* http/tests/referrer-policy-anchor/origin-when-cross-origin/cross-origin-http.https-expected.txt: Added.
* http/tests/referrer-policy-anchor/origin-when-cross-origin/cross-origin-http.https.html: Added.
* http/tests/referrer-policy-anchor/origin-when-cross-origin/same-origin-expected.txt: Added.
* http/tests/referrer-policy-anchor/origin-when-cross-origin/same-origin.html: Added.
* http/tests/referrer-policy-anchor/origin/cross-origin-http-http-expected.txt: Added.
* http/tests/referrer-policy-anchor/origin/cross-origin-http-http.html: Added.
* http/tests/referrer-policy-anchor/origin/cross-origin-http.https-expected.txt: Added.
* http/tests/referrer-policy-anchor/origin/cross-origin-http.https.html: Added.
* http/tests/referrer-policy-anchor/origin/same-origin-expected.txt: Added.
* http/tests/referrer-policy-anchor/origin/same-origin.html: Added.
* http/tests/referrer-policy-anchor/same-origin/cross-origin-http-http-expected.txt: Added.
* http/tests/referrer-policy-anchor/same-origin/cross-origin-http-http.html: Added.
* http/tests/referrer-policy-anchor/same-origin/cross-origin-http.https-expected.txt: Added.
* http/tests/referrer-policy-anchor/same-origin/cross-origin-http.https.html: Added.
* http/tests/referrer-policy-anchor/same-origin/same-origin-expected.txt: Added.
* http/tests/referrer-policy-anchor/same-origin/same-origin.html: Added.
* http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/cross-origin-http-http-expected.txt: Added.
* http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/cross-origin-http-http.html: Added.
* http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/cross-origin-http.https-expected.txt: Added.
* http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/cross-origin-http.https.html: Added.
* http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/same-origin-expected.txt: Added.
* http/tests/referrer-policy-anchor/strict-origin-when-cross-origin/same-origin.html: Added.
* http/tests/referrer-policy-anchor/strict-origin/cross-origin-http-http-expected.txt: Added.
* http/tests/referrer-policy-anchor/strict-origin/cross-origin-http-http.html: Added.
* http/tests/referrer-policy-anchor/strict-origin/cross-origin-http.https-expected.txt: Added.
* http/tests/referrer-policy-anchor/strict-origin/cross-origin-http.https.html: Added.
* http/tests/referrer-policy-anchor/strict-origin/same-origin-expected.txt: Added.
* http/tests/referrer-policy-anchor/strict-origin/same-origin.html: Added.
* http/tests/referrer-policy-anchor/unsafe-url/cross-origin-http-http-expected.txt: Added.
* http/tests/referrer-policy-anchor/unsafe-url/cross-origin-http-http.html: Added.
* http/tests/referrer-policy-anchor/unsafe-url/cross-origin-http.https-expected.txt: Added.
* http/tests/referrer-policy-anchor/unsafe-url/cross-origin-http.https.html: Added.
* http/tests/referrer-policy-anchor/unsafe-url/same-origin-expected.txt: Added.
* http/tests/referrer-policy-anchor/unsafe-url/same-origin.html: Added.
* http/tests/referrer-policy/resources/check-referrer.php: Added.
* js/dom/dom-static-property-for-in-iteration-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/gtk/js/dom/dom-static-property-for-in-iteration-expected.txt:
* platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/ios-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt:
* platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt:
* platform/win/TestExpectations:
* platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* platform/wpe/js/dom/dom-static-property-for-in-iteration-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@257707 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/FrameLoadRequest.cpp b/Source/WebCore/loader/FrameLoadRequest.cpp
index 827e493..743d73d 100644
--- a/Source/WebCore/loader/FrameLoadRequest.cpp
+++ b/Source/WebCore/loader/FrameLoadRequest.cpp
@@ -37,14 +37,14 @@
namespace WebCore {
-FrameLoadRequest::FrameLoadRequest(Document& requester, SecurityOrigin& requesterSecurityOrigin, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, InitiatedByMainFrame initiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL, const AtomString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo)
+FrameLoadRequest::FrameLoadRequest(Document& requester, SecurityOrigin& requesterSecurityOrigin, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, const ReferrerPolicy& referrerPolicy, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, InitiatedByMainFrame initiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL, const AtomString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo)
: m_requester { makeRef(requester) }
, m_requesterSecurityOrigin { makeRef(requesterSecurityOrigin) }
, m_resourceRequest { resourceRequest }
, m_frameName { frameName }
, m_lockHistory { lockHistory }
, m_lockBackForwardList { lockBackForwardList }
- , m_shouldSendReferrer { shouldSendReferrer }
+ , m_referrerPolicy { referrerPolicy }
, m_allowNavigationToInvalidURL { allowNavigationToInvalidURL }
, m_newFrameOpenerPolicy { newFrameOpenerPolicy }
, m_shouldReplaceDocumentIfJavaScriptURL { shouldReplaceDocumentIfJavaScriptURL }
@@ -62,7 +62,6 @@
, m_substituteData { substituteData }
, m_lockHistory { LockHistory::No }
, m_lockBackForwardList { LockBackForwardList::No }
- , m_shouldSendReferrer { MaybeSendReferrer }
, m_allowNavigationToInvalidURL { AllowNavigationToInvalidURL::Yes }
, m_newFrameOpenerPolicy { NewFrameOpenerPolicy::Allow }
, m_shouldReplaceDocumentIfJavaScriptURL { ReplaceDocumentIfJavaScriptURL }
diff --git a/Source/WebCore/loader/FrameLoadRequest.h b/Source/WebCore/loader/FrameLoadRequest.h
index 79a4ba2..967c99b 100644
--- a/Source/WebCore/loader/FrameLoadRequest.h
+++ b/Source/WebCore/loader/FrameLoadRequest.h
@@ -26,6 +26,7 @@
#pragma once
#include "FrameLoaderTypes.h"
+#include "ReferrerPolicy.h"
#include "ResourceRequest.h"
#include "SubstituteData.h"
#include <wtf/Forward.h>
@@ -38,7 +39,7 @@
class FrameLoadRequest {
public:
- WEBCORE_EXPORT FrameLoadRequest(Document&, SecurityOrigin&, const ResourceRequest&, const String& frameName, LockHistory, LockBackForwardList, ShouldSendReferrer, AllowNavigationToInvalidURL, NewFrameOpenerPolicy, ShouldOpenExternalURLsPolicy, InitiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL, const AtomString& downloadAttribute = { }, const SystemPreviewInfo& = { });
+ WEBCORE_EXPORT FrameLoadRequest(Document&, SecurityOrigin&, const ResourceRequest&, const String& frameName, LockHistory, LockBackForwardList, const ReferrerPolicy&, AllowNavigationToInvalidURL, NewFrameOpenerPolicy, ShouldOpenExternalURLsPolicy, InitiatedByMainFrame, ShouldReplaceDocumentIfJavaScriptURL = ReplaceDocumentIfJavaScriptURL, const AtomString& downloadAttribute = { }, const SystemPreviewInfo& = { });
WEBCORE_EXPORT FrameLoadRequest(Frame&, const ResourceRequest&, ShouldOpenExternalURLsPolicy, const SubstituteData& = SubstituteData());
WEBCORE_EXPORT ~FrameLoadRequest();
@@ -76,7 +77,7 @@
const String& clientRedirectSourceForHistory() const { return m_clientRedirectSourceForHistory; }
void setClientRedirectSourceForHistory(const String& clientRedirectSourceForHistory) { m_clientRedirectSourceForHistory = clientRedirectSourceForHistory; }
- ShouldSendReferrer shouldSendReferrer() const { return m_shouldSendReferrer; }
+ ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; }
AllowNavigationToInvalidURL allowNavigationToInvalidURL() const { return m_allowNavigationToInvalidURL; }
NewFrameOpenerPolicy newFrameOpenerPolicy() const { return m_newFrameOpenerPolicy; }
@@ -109,7 +110,7 @@
bool m_shouldTreatAsContinuingLoad { false };
LockHistory m_lockHistory;
LockBackForwardList m_lockBackForwardList;
- ShouldSendReferrer m_shouldSendReferrer;
+ ReferrerPolicy m_referrerPolicy { ReferrerPolicy::EmptyString };
AllowNavigationToInvalidURL m_allowNavigationToInvalidURL;
NewFrameOpenerPolicy m_newFrameOpenerPolicy;
ShouldReplaceDocumentIfJavaScriptURL m_shouldReplaceDocumentIfJavaScriptURL;
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 0b8b520..9c18d76 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -421,13 +421,13 @@
urlSelected(WTFMove(request), nullptr);
}
-void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, Optional<NewFrameOpenerPolicy> openerPolicy, const AtomString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo, Optional<AdClickAttribution>&& adClickAttribution)
+void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, const ReferrerPolicy& referrerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, Optional<NewFrameOpenerPolicy> openerPolicy, const AtomString& downloadAttribute, const SystemPreviewInfo& systemPreviewInfo, Optional<AdClickAttribution>&& adClickAttribution)
{
auto* frame = lexicalFrameFromCommonVM();
auto initiatedByMainFrame = frame && frame->isMainFrame() ? InitiatedByMainFrame::Yes : InitiatedByMainFrame::Unknown;
- NewFrameOpenerPolicy newFrameOpenerPolicy = openerPolicy.valueOr(shouldSendReferrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerPolicy::Allow);
- urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securityOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute, systemPreviewInfo), triggeringEvent, WTFMove(adClickAttribution));
+ NewFrameOpenerPolicy newFrameOpenerPolicy = openerPolicy.valueOr(referrerPolicy == ReferrerPolicy::NoReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerPolicy::Allow);
+ urlSelected(FrameLoadRequest(*m_frame.document(), m_frame.document()->securityOrigin(), { url }, passedTarget, lockHistory, lockBackForwardList, referrerPolicy, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, shouldOpenExternalURLsPolicy, initiatedByMainFrame, DoNotReplaceDocumentIfJavaScriptURL, downloadAttribute, systemPreviewInfo), triggeringEvent, WTFMove(adClickAttribution));
}
void FrameLoader::urlSelected(FrameLoadRequest&& frameRequest, Event* triggeringEvent, Optional<AdClickAttribution>&& adClickAttribution)
@@ -993,7 +993,7 @@
auto* lexicalFrame = lexicalFrameFromCommonVM();
auto initiatedByMainFrame = lexicalFrame && lexicalFrame->isMainFrame() ? InitiatedByMainFrame::Yes : InitiatedByMainFrame::Unknown;
- FrameLoadRequest frameLoadRequest { *m_frame.document(), m_frame.document()->securityOrigin(), { url }, "_self"_s, LockHistory::No, LockBackForwardList::Yes, ShouldSendReferrer::MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ShouldOpenExternalURLsPolicy::ShouldNotAllow, initiatedByMainFrame };
+ FrameLoadRequest frameLoadRequest { *m_frame.document(), m_frame.document()->securityOrigin(), { url }, "_self"_s, LockHistory::No, LockBackForwardList::Yes, ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Suppress, ShouldOpenExternalURLsPolicy::ShouldNotAllow, initiatedByMainFrame };
childFrame->loader().loadURL(WTFMove(frameLoadRequest), referer, FrameLoadType::RedirectWithLockedBackForwardList, nullptr, { }, WTF::nullopt, [] { });
}
@@ -1270,9 +1270,10 @@
if (argsReferrer.isEmpty())
argsReferrer = outgoingReferrer();
- String referrer = SecurityPolicy::generateReferrerHeader(m_frame.document()->referrerPolicy(), url, argsReferrer);
- if (request.shouldSendReferrer() == NeverSendReferrer)
- referrer = String();
+ ReferrerPolicy referrerPolicy = request.referrerPolicy();
+ if (referrerPolicy == ReferrerPolicy::EmptyString)
+ referrerPolicy = m_frame.document()->referrerPolicy();
+ String referrer = SecurityPolicy::generateReferrerHeader(referrerPolicy, url, argsReferrer);
FrameLoadType loadType;
if (request.resourceRequest().cachePolicy() == ResourceRequestCachePolicy::ReloadIgnoringCacheData)
diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h
index 0a028b9..7af42b5 100644
--- a/Source/WebCore/loader/FrameLoader.h
+++ b/Source/WebCore/loader/FrameLoader.h
@@ -130,7 +130,7 @@
unsigned long loadResourceSynchronously(const ResourceRequest&, ClientCredentialPolicy, const FetchOptions&, const HTTPHeaderMap&, ResourceError&, ResourceResponse&, RefPtr<SharedBuffer>& data);
void changeLocation(FrameLoadRequest&&);
- WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy, Optional<NewFrameOpenerPolicy> = WTF::nullopt, const AtomString& downloadAttribute = nullAtom(), const SystemPreviewInfo& = { }, Optional<AdClickAttribution>&& = WTF::nullopt);
+ WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, const ReferrerPolicy&, ShouldOpenExternalURLsPolicy, Optional<NewFrameOpenerPolicy> = WTF::nullopt, const AtomString& downloadAttribute = nullAtom(), const SystemPreviewInfo& = { }, Optional<AdClickAttribution>&& = WTF::nullopt);
void submitForm(Ref<FormSubmission>&&);
WEBCORE_EXPORT void reload(OptionSet<ReloadOption> = { });
diff --git a/Source/WebCore/loader/FrameLoaderTypes.h b/Source/WebCore/loader/FrameLoaderTypes.h
index 41e6d33..bc057f2 100644
--- a/Source/WebCore/loader/FrameLoaderTypes.h
+++ b/Source/WebCore/loader/FrameLoaderTypes.h
@@ -160,11 +160,6 @@
UnloadEventPolicyUnloadAndPageHide
};
-enum ShouldSendReferrer {
- MaybeSendReferrer,
- NeverSendReferrer
-};
-
// Passed to FrameLoader::urlSelected() and ScriptController::executeIfJavaScriptURL()
// to control whether, in the case of a JavaScript URL, executeIfJavaScriptURL() should
// replace the document. It is a FIXME to eliminate this extra parameter from
diff --git a/Source/WebCore/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp
index 80ded79..929da06 100644
--- a/Source/WebCore/loader/NavigationScheduler.cpp
+++ b/Source/WebCore/loader/NavigationScheduler.cpp
@@ -185,7 +185,7 @@
ResourceRequest resourceRequest { url(), referrer(), refresh ? ResourceRequestCachePolicy::ReloadIgnoringCacheData : ResourceRequestCachePolicy::UseProtocolCachePolicy };
if (initiatedByMainFrame() == InitiatedByMainFrame::Yes)
resourceRequest.setRequester(ResourceRequest::Requester::Main);
- FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
+ FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
frame.loader().changeLocation(WTFMove(frameLoadRequest));
}
@@ -210,7 +210,7 @@
UserGestureIndicator gestureIndicator { userGestureToForward() };
ResourceRequest resourceRequest { url(), referrer(), ResourceRequestCachePolicy::UseProtocolCachePolicy };
- FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
+ FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
auto completionHandler = WTFMove(m_completionHandler);
frame.loader().changeLocation(WTFMove(frameLoadRequest));
@@ -233,7 +233,7 @@
UserGestureIndicator gestureIndicator { userGestureToForward() };
ResourceRequest resourceRequest { url(), referrer(), ResourceRequestCachePolicy::ReloadIgnoringCacheData };
- FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
+ FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), resourceRequest, "_self", lockHistory(), lockBackForwardList(), ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
frame.loader().changeLocation(WTFMove(frameLoadRequest));
}
@@ -254,7 +254,7 @@
if (!m_historySteps) {
// Special case for go(0) from a frame -> reload only the frame
// To follow Firefox and IE's behavior, history reload can only navigate the self frame.
- frame.loader().urlSelected(frame.document()->url(), "_self", 0, lockHistory(), lockBackForwardList(), MaybeSendReferrer, shouldOpenExternalURLs());
+ frame.loader().urlSelected(frame.document()->url(), "_self", 0, lockHistory(), lockBackForwardList(), ReferrerPolicy::EmptyString, shouldOpenExternalURLs());
return;
}
@@ -289,7 +289,7 @@
auto& requestingDocument = m_submission->state().sourceDocument();
if (!requestingDocument.canNavigate(&frame))
return;
- FrameLoadRequest frameLoadRequest { requestingDocument, requestingDocument.securityOrigin(), { }, { }, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
+ FrameLoadRequest frameLoadRequest { requestingDocument, requestingDocument.securityOrigin(), { }, { }, lockHistory(), lockBackForwardList(), ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
m_submission->populateFrameLoadRequest(frameLoadRequest);
frame.loader().loadFrameRequest(WTFMove(frameLoadRequest), m_submission->event(), m_submission->takeState());
}
@@ -339,7 +339,7 @@
SubstituteData replacementData { SharedBuffer::create(), m_originDocument.url(), replacementResponse, SubstituteData::SessionHistoryVisibility::Hidden };
ResourceRequest resourceRequest { m_originDocument.url(), emptyString(), ResourceRequestCachePolicy::ReloadIgnoringCacheData };
- FrameLoadRequest frameLoadRequest { m_originDocument, m_originDocument.securityOrigin(), resourceRequest, { }, lockHistory(), lockBackForwardList(), MaybeSendReferrer, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
+ FrameLoadRequest frameLoadRequest { m_originDocument, m_originDocument.securityOrigin(), resourceRequest, { }, lockHistory(), lockBackForwardList(), ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::Yes, NewFrameOpenerPolicy::Allow, shouldOpenExternalURLs(), initiatedByMainFrame() };
frameLoadRequest.setSubstituteData(replacementData);
frame.loader().load(WTFMove(frameLoadRequest));
}
@@ -439,7 +439,7 @@
auto* frame = lexicalFrameFromCommonVM();
auto initiatedByMainFrame = frame && frame->isMainFrame() ? InitiatedByMainFrame::Yes : InitiatedByMainFrame::Unknown;
- FrameLoadRequest frameLoadRequest { initiatingDocument, securityOrigin, resourceRequest, "_self"_s, lockHistory, lockBackForwardList, MaybeSendReferrer, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, initiatingDocument.shouldOpenExternalURLsPolicyToPropagate(), initiatedByMainFrame };
+ FrameLoadRequest frameLoadRequest { initiatingDocument, securityOrigin, resourceRequest, "_self"_s, lockHistory, lockBackForwardList, ReferrerPolicy::EmptyString, AllowNavigationToInvalidURL::No, NewFrameOpenerPolicy::Allow, initiatingDocument.shouldOpenExternalURLsPolicyToPropagate(), initiatedByMainFrame };
loader.changeLocation(WTFMove(frameLoadRequest));
return completionHandler();
}