Diff
Modified: trunk/Source/WTF/ChangeLog (285037 => 285038)
--- trunk/Source/WTF/ChangeLog 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WTF/ChangeLog 2021-10-29 17:27:20 UTC (rev 285038)
@@ -1,3 +1,13 @@
+2021-10-29 Darin Adler <[email protected]>
+
+ Create constants for all special frame names used in anchor target attribute values and elsewhere
+ https://bugs.webkit.org/show_bug.cgi?id=232488
+
+ Reviewed by Anders Carlsson.
+
+ * wtf/Forward.h: Declare ASCIILiteral.
+ * wtf/text/ASCIILiteral.h: Update for above.
+
2021-10-29 Saam Barati <[email protected]>
Disable ENABLE_JIT on arm64_32
Modified: trunk/Source/WTF/wtf/Forward.h (285037 => 285038)
--- trunk/Source/WTF/wtf/Forward.h 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WTF/wtf/Forward.h 2021-10-29 17:27:20 UTC (rev 285038)
@@ -25,6 +25,7 @@
namespace WTF {
+class ASCIILiteral;
class AbstractLocker;
class AtomString;
class AtomStringImpl;
@@ -47,8 +48,8 @@
class SuspendableWorkQueue;
class TextPosition;
class TextStream;
+class URL;
class UniquedStringImpl;
-class URL;
class WallTime;
struct AnyThreadsAccessTraits;
@@ -118,6 +119,7 @@
template<class> class unexpected;
}}} // namespace std::experimental::fundamentals_v3
+using WTF::ASCIILiteral;
using WTF::AbstractLocker;
using WTF::AtomString;
using WTF::AtomStringImpl;
Modified: trunk/Source/WTF/wtf/text/ASCIILiteral.h (285037 => 285038)
--- trunk/Source/WTF/wtf/text/ASCIILiteral.h 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WTF/wtf/text/ASCIILiteral.h 2021-10-29 17:27:20 UTC (rev 285038)
@@ -26,6 +26,7 @@
#pragma once
#include <wtf/ASCIICType.h>
+#include <wtf/Forward.h>
#include <wtf/StdLibExtras.h>
namespace WTF {
@@ -78,4 +79,3 @@
} // namespace WTF
using namespace WTF::StringLiterals;
-using WTF::ASCIILiteral;
Modified: trunk/Source/WebCore/ChangeLog (285037 => 285038)
--- trunk/Source/WebCore/ChangeLog 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/ChangeLog 2021-10-29 17:27:20 UTC (rev 285038)
@@ -1,3 +1,54 @@
+2021-10-29 Darin Adler <[email protected]>
+
+ Create constants for all special frame names used in anchor target attribute values and elsewhere
+ https://bugs.webkit.org/show_bug.cgi?id=232488
+
+ Reviewed by Anders Carlsson.
+
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::handleClick): Use isBlankTargetFrameName.
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::submit): Ditto.
+
+ * inspector/InspectorFrontendClientLocal.cpp:
+ (WebCore::InspectorFrontendClientLocal::openURLExternally): Use
+ blankTargetFrameName and selfTargetFrameName.
+ * inspector/agents/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::navigate): Ditto.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadURLIntoChildFrame): Use selfTargetFrameName.
+ (WebCore::FrameLoader::loadURL): Use selfTargetFrameName and blankTargetFrameName.
+ (WebCore::FrameLoader::loadPostRequest): Use blankTargetFrameName.
+ (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Ditto.
+ (WebCore::createWindow): Use isBlankTargetFrameName.
+
+ * loader/NavigationScheduler.cpp:
+ (WebCore::NavigationScheduler::scheduleLocationChange): Use selfTargetFrameName.
+
+ * mathml/MathMLElement.cpp:
+ (WebCore::MathMLElement::defaultEventHandler): Use selfTargetFrameName.
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::createWindow): Use selfTargetFrameName.
+ (WebCore::DOMWindow::open): Use isTopTargetFrameName and isParentTargetFrameName.
+
+ * page/FrameTree.cpp:
+ (WebCore::FrameTree::uniqueChildName const): Use isBlankTargetFrameName.
+ (WebCore::FrameTree::find const): Use isSelfTargetFrameName, isTopTargetFrameName,
+ isParentTargetFrameName, and isBlankTargetFrameName.
+ (WebCore::blankTargetFrameName): Added.
+ (WebCore::selfTargetFrameName): Added.
+ (WebCore::isBlankTargetFrameName): Added.
+ (WebCore::isParentTargetFrameName): Added.
+ (WebCore::isSelfTargetFrameName): Added.
+ (WebCore::isTopTargetFrameName): Added.
+
+ * page/FrameTree.h: Add declarations.
+
+ * svg/SVGAElement.cpp:
+ (WebCore::SVGAElement::defaultEventHandler): Use blankTargetFrameName.
+
2021-10-29 Aditya Keerthi <[email protected]>
REGRESSION (r283269) disneyplus.com time remaining bar shows an extra line/bar
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (285037 => 285038)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -528,7 +528,7 @@
auto effectiveTarget = this->effectiveTarget();
NewFrameOpenerPolicy newFrameOpenerPolicy = NewFrameOpenerPolicy::Allow;
- if (hasRel(Relation::NoOpener) || hasRel(Relation::NoReferrer) || (!hasRel(Relation::Opener) && document().settings().blankAnchorTargetImpliesNoOpenerEnabled() && equalIgnoringASCIICase(effectiveTarget, "_blank")))
+ if (hasRel(Relation::NoOpener) || hasRel(Relation::NoReferrer) || (!hasRel(Relation::Opener) && document().settings().blankAnchorTargetImpliesNoOpenerEnabled() && isBlankTargetFrameName(effectiveTarget)))
newFrameOpenerPolicy = NewFrameOpenerPolicy::Suppress;
auto privateClickMeasurement = parsePrivateClickMeasurement();
Modified: trunk/Source/WebCore/html/HTMLFormElement.cpp (285037 => 285038)
--- trunk/Source/WebCore/html/HTMLFormElement.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/html/HTMLFormElement.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -428,7 +428,7 @@
return;
auto relAttributes = parseFormRelAttributes(getAttribute(HTMLNames::relAttr));
- if (relAttributes.noopener || relAttributes.noreferrer || (!relAttributes.opener && document().settings().blankAnchorTargetImpliesNoOpenerEnabled() && equalIgnoringASCIICase(formSubmission->target(), "_blank")))
+ if (relAttributes.noopener || relAttributes.noreferrer || (!relAttributes.opener && document().settings().blankAnchorTargetImpliesNoOpenerEnabled() && isBlankTargetFrameName(formSubmission->target())))
formSubmission->setNewFrameOpenerPolicy(NewFrameOpenerPolicy::Suppress);
if (relAttributes.noreferrer)
formSubmission->setReferrerPolicy(ReferrerPolicy::NoReferrer);
Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (285037 => 285038)
--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -267,7 +267,7 @@
{
UserGestureIndicator indicator { ProcessingUserGesture };
Frame& mainFrame = m_inspectedPageController->inspectedPage().mainFrame();
- FrameLoadRequest frameLoadRequest { *mainFrame.document(), mainFrame.document()->securityOrigin(), { }, "_blank"_s, InitiatedByMainFrame::Unknown };
+ FrameLoadRequest frameLoadRequest { *mainFrame.document(), mainFrame.document()->securityOrigin(), { }, blankTargetFrameName(), InitiatedByMainFrame::Unknown };
bool created;
WindowFeatures features;
@@ -280,7 +280,7 @@
// 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(), mainFrame.document()->securityOrigin(), WTFMove(resourceRequest), "_self"_s, InitiatedByMainFrame::Unknown };
+ FrameLoadRequest frameLoadRequest2 { *mainFrame.document(), mainFrame.document()->securityOrigin(), WTFMove(resourceRequest), selfTargetFrameName(), InitiatedByMainFrame::Unknown };
frame->loader().changeLocation(WTFMove(frameLoadRequest2));
}
Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (285037 => 285038)
--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -413,7 +413,7 @@
Frame& frame = m_inspectedPage.mainFrame();
ResourceRequest resourceRequest { frame.document()->completeURL(url) };
- FrameLoadRequest frameLoadRequest { *frame.document(), frame.document()->securityOrigin(), WTFMove(resourceRequest), "_self"_s, InitiatedByMainFrame::Unknown };
+ FrameLoadRequest frameLoadRequest { *frame.document(), frame.document()->securityOrigin(), WTFMove(resourceRequest), selfTargetFrameName(), InitiatedByMainFrame::Unknown };
frameLoadRequest.disableNavigationToInvalidURL();
frame.loader().changeLocation(WTFMove(frameLoadRequest));
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (285037 => 285038)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -985,7 +985,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, initiatedByMainFrame };
+ FrameLoadRequest frameLoadRequest { *m_frame.document(), m_frame.document()->securityOrigin(), { url }, selfTargetFrameName(), initiatedByMainFrame };
frameLoadRequest.setNewFrameOpenerPolicy(NewFrameOpenerPolicy::Suppress);
frameLoadRequest.setLockBackForwardList(LockBackForwardList::Yes);
childFrame->loader().loadURL(WTFMove(frameLoadRequest), referer, FrameLoadType::RedirectWithLockedBackForwardList, nullptr, { }, std::nullopt, [] { });
@@ -1346,7 +1346,7 @@
// The search for a target frame is done earlier in the case of form submission.
auto targetFrame = isFormSubmission ? nullptr : RefPtr { findFrameForNavigation(effectiveFrameName) };
if (targetFrame && targetFrame != &m_frame) {
- frameLoadRequest.setFrameName("_self");
+ frameLoadRequest.setFrameName(selfTargetFrameName());
targetFrame->loader().loadURL(WTFMove(frameLoadRequest), referrer, newLoadType, event, WTFMove(formState), WTFMove(privateClickMeasurement), completionHandlerCaller.release());
return;
}
@@ -1376,7 +1376,7 @@
// https://html.spec.whatwg.org/#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name (Step 8.2)
if (frameLoadRequest.requester().shouldForceNoOpenerBasedOnCOOP()) {
- effectiveFrameName = "_blank"_s;
+ effectiveFrameName = blankTargetFrameName();
openerPolicy = NewFrameOpenerPolicy::Suppress;
}
@@ -3082,7 +3082,7 @@
// https://html.spec.whatwg.org/#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name (Step 8.2)
if (request.requester().shouldForceNoOpenerBasedOnCOOP()) {
- frameName = "_blank"_s;
+ frameName = blankTargetFrameName();
openerPolicy = NewFrameOpenerPolicy::Suppress;
}
@@ -3574,7 +3574,7 @@
if (sandboxFlags & SandboxPropagatesToAuxiliaryBrowsingContexts)
mainFrame->loader().forceSandboxFlags(sandboxFlags);
- if (!equalIgnoringASCIICase(frameName, "_blank"))
+ if (!isBlankTargetFrameName(frameName))
mainFrame->tree().setName(frameName);
mainFrame->page()->setOpenedByDOM();
@@ -4105,9 +4105,9 @@
if (request.resourceRequest().url().protocolIsJavaScript() && !openerFrame.document()->contentSecurityPolicy()->allowJavaScriptURLs(openerFrame.document()->url().string(), { }, request.resourceRequest().url().string()))
return nullptr;
- if (!request.frameName().isEmpty() && !equalIgnoringASCIICase(request.frameName(), "_blank")) {
+ if (!request.frameName().isEmpty() && !isBlankTargetFrameName(request.frameName())) {
if (RefPtr<Frame> frame = lookupFrame.loader().findFrameForNavigation(request.frameName(), openerFrame.document())) {
- if (!equalIgnoringASCIICase(request.frameName(), "_self")) {
+ if (!isSelfTargetFrameName(request.frameName())) {
if (Page* page = frame->page())
page->chrome().focus();
}
@@ -4117,7 +4117,7 @@
// https://html.spec.whatwg.org/#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name (Step 8.2)
if (openerFrame.document()->shouldForceNoOpenerBasedOnCOOP()) {
- request.setFrameName("_blank"_s);
+ request.setFrameName(blankTargetFrameName());
features.noopener = true;
}
@@ -4149,7 +4149,7 @@
if (isDocumentSandboxed(openerFrame, SandboxPropagatesToAuxiliaryBrowsingContexts))
frame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlags());
- if (!equalIgnoringASCIICase(request.frameName(), "_blank"))
+ if (!isBlankTargetFrameName(request.frameName()))
frame->tree().setName(request.frameName());
page->chrome().setToolbarsVisible(features.toolBarVisible || features.locationBarVisible);
Modified: trunk/Source/WebCore/loader/NavigationScheduler.cpp (285037 => 285038)
--- trunk/Source/WebCore/loader/NavigationScheduler.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/loader/NavigationScheduler.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -194,7 +194,7 @@
ResourceRequest resourceRequest { url(), referrer(), refresh ? ResourceRequestCachePolicy::ReloadIgnoringCacheData : ResourceRequestCachePolicy::UseProtocolCachePolicy };
if (initiatedByMainFrame() == InitiatedByMainFrame::Yes)
resourceRequest.setRequester(ResourceRequest::Requester::Main);
- FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), WTFMove(resourceRequest), "_self", initiatedByMainFrame() };
+ FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), WTFMove(resourceRequest), selfTargetFrameName(), initiatedByMainFrame() };
frameLoadRequest.setLockHistory(lockHistory());
frameLoadRequest.setLockBackForwardList(lockBackForwardList());
frameLoadRequest.disableNavigationToInvalidURL();
@@ -226,7 +226,7 @@
UserGestureIndicator gestureIndicator { userGestureToForward() };
ResourceRequest resourceRequest { url(), referrer(), ResourceRequestCachePolicy::UseProtocolCachePolicy };
- FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), WTFMove(resourceRequest), "_self", initiatedByMainFrame() };
+ FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), WTFMove(resourceRequest), selfTargetFrameName(), initiatedByMainFrame() };
frameLoadRequest.setLockHistory(lockHistory());
frameLoadRequest.setLockBackForwardList(lockBackForwardList());
frameLoadRequest.disableNavigationToInvalidURL();
@@ -253,7 +253,7 @@
UserGestureIndicator gestureIndicator { userGestureToForward() };
ResourceRequest resourceRequest { url(), referrer(), ResourceRequestCachePolicy::ReloadIgnoringCacheData };
- FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), WTFMove(resourceRequest), "_self", initiatedByMainFrame() };
+ FrameLoadRequest frameLoadRequest { initiatingDocument(), *securityOrigin(), WTFMove(resourceRequest), selfTargetFrameName(), initiatedByMainFrame() };
frameLoadRequest.setLockHistory(lockHistory());
frameLoadRequest.setLockBackForwardList(lockBackForwardList());
frameLoadRequest.setShouldOpenExternalURLsPolicy(shouldOpenExternalURLs());
@@ -277,7 +277,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().changeLocation(frame.document()->url(), "_self", 0, ReferrerPolicy::EmptyString, shouldOpenExternalURLs());
+ frame.loader().changeLocation(frame.document()->url(), selfTargetFrameName(), 0, ReferrerPolicy::EmptyString, shouldOpenExternalURLs());
return;
}
@@ -470,7 +470,7 @@
auto* frame = lexicalFrameFromCommonVM();
auto initiatedByMainFrame = frame && frame->isMainFrame() ? InitiatedByMainFrame::Yes : InitiatedByMainFrame::Unknown;
- FrameLoadRequest frameLoadRequest { initiatingDocument, securityOrigin, WTFMove(resourceRequest), "_self"_s, initiatedByMainFrame };
+ FrameLoadRequest frameLoadRequest { initiatingDocument, securityOrigin, WTFMove(resourceRequest), selfTargetFrameName(), initiatedByMainFrame };
frameLoadRequest.setLockHistory(lockHistory);
frameLoadRequest.setLockBackForwardList(lockBackForwardList);
frameLoadRequest.disableNavigationToInvalidURL();
Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (285037 => 285038)
--- trunk/Source/WebCore/mathml/MathMLElement.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -198,7 +198,7 @@
const auto& url = ""
event.setDefaultHandled();
if (auto* frame = document().frame())
- frame->loader().changeLocation(document().completeURL(url), "_self", &event, ReferrerPolicy::EmptyString, document().shouldOpenExternalURLsPolicyToPropagate());
+ frame->loader().changeLocation(document().completeURL(url), selfTargetFrameName(), &event, ReferrerPolicy::EmptyString, document().shouldOpenExternalURLsPolicyToPropagate());
return;
}
}
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (285037 => 285038)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -2539,7 +2539,7 @@
if (created) {
ResourceRequest resourceRequest { completedURL, referrer, ResourceRequestCachePolicy::UseProtocolCachePolicy };
FrameLoader::addSameSiteInfoToRequestIfNeeded(resourceRequest, openerFrame.document());
- FrameLoadRequest frameLoadRequest { *activeWindow.document(), activeWindow.document()->securityOrigin(), WTFMove(resourceRequest), "_self"_s, initiatedByMainFrame };
+ FrameLoadRequest frameLoadRequest { *activeWindow.document(), activeWindow.document()->securityOrigin(), WTFMove(resourceRequest), selfTargetFrameName(), initiatedByMainFrame };
frameLoadRequest.setShouldOpenExternalURLsPolicy(activeDocument->shouldOpenExternalURLsPolicyToPropagate());
newFrame->loader().changeLocation(WTFMove(frameLoadRequest));
} else if (!urlString.isEmpty()) {
@@ -2608,9 +2608,9 @@
// Get the target frame for the special cases of _top and _parent.
// In those cases, we schedule a location change right now and return early.
RefPtr<Frame> targetFrame;
- if (equalIgnoringASCIICase(frameName, "_top"))
+ if (isTopTargetFrameName(frameName))
targetFrame = &frame->tree().top();
- else if (equalIgnoringASCIICase(frameName, "_parent")) {
+ else if (isParentTargetFrameName(frameName)) {
if (RefPtr parent = frame->tree().parent())
targetFrame = parent;
else
Modified: trunk/Source/WebCore/page/FrameTree.cpp (285037 => 285038)
--- trunk/Source/WebCore/page/FrameTree.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/page/FrameTree.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -103,7 +103,7 @@
AtomString FrameTree::uniqueChildName(const AtomString& requestedName) const
{
// If the requested name (the frame's "name" attribute) is unique, just use that.
- if (!requestedName.isEmpty() && !child(requestedName) && !equalIgnoringASCIICase(requestedName, "_blank"))
+ if (!requestedName.isEmpty() && !child(requestedName) && !isBlankTargetFrameName(requestedName))
return requestedName;
// The "name" attribute was not unique or absent. Generate a name based on a counter on the main frame that gets reset
@@ -237,18 +237,17 @@
Frame* FrameTree::find(const AtomString& name, Frame& activeFrame) const
{
- // FIXME: _current is not part of the HTML specification.
- if (equalIgnoringASCIICase(name, "_self") || name == "_current" || name.isEmpty())
+ if (isSelfTargetFrameName(name))
return &m_thisFrame;
- if (equalIgnoringASCIICase(name, "_top"))
+ if (isTopTargetFrameName(name))
return &top();
- if (equalIgnoringASCIICase(name, "_parent"))
+ if (isParentTargetFrameName(name))
return parent() ? parent() : &m_thisFrame;
- // Since "_blank" should never be any frame's name, the following is only an optimization.
- if (equalIgnoringASCIICase(name, "_blank"))
+ // Since "_blank" cannot be a frame's name, this check is an optimization, not for correctness.
+ if (isBlankTargetFrameName(name))
return nullptr;
// Search subtree starting with this frame first.
@@ -264,11 +263,11 @@
}
// Search the entire tree of each of the other pages in this namespace.
- // FIXME: Is random order OK?
Page* page = m_thisFrame.page();
if (!page)
return nullptr;
+ // FIXME: These pages are searched in random order; that doesn't seem good. Maybe use order of creation?
for (auto& otherPage : page->group().pages()) {
if (&otherPage == page || otherPage.isClosing())
continue;
@@ -460,6 +459,38 @@
return *frame;
}
+ASCIILiteral blankTargetFrameName()
+{
+ return "_blank"_s;
+}
+
+// FIXME: Is it important to have this? Can't we just use the empty string everywhere this is used, instead?
+ASCIILiteral selfTargetFrameName()
+{
+ return "_self"_s;
+}
+
+bool isBlankTargetFrameName(StringView name)
+{
+ return equalLettersIgnoringASCIICase(name, "_blank");
+}
+
+bool isParentTargetFrameName(StringView name)
+{
+ return equalLettersIgnoringASCIICase(name, "_parent");
+}
+
+bool isSelfTargetFrameName(StringView name)
+{
+ // FIXME: Some day we should remove _current, which is not part of the HTML specification.
+ return name.isEmpty() || equalLettersIgnoringASCIICase(name, "_self") || name == "_current";
+}
+
+bool isTopTargetFrameName(StringView name)
+{
+ return equalLettersIgnoringASCIICase(name, "_top");
+}
+
} // namespace WebCore
#ifndef NDEBUG
Modified: trunk/Source/WebCore/page/FrameTree.h (285037 => 285038)
--- trunk/Source/WebCore/page/FrameTree.h 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/page/FrameTree.h 2021-10-29 17:27:20 UTC (rev 285038)
@@ -107,6 +107,14 @@
mutable uint64_t m_frameIDGenerator { 0 };
};
+ASCIILiteral blankTargetFrameName();
+ASCIILiteral selfTargetFrameName();
+
+bool isBlankTargetFrameName(StringView);
+bool isParentTargetFrameName(StringView);
+bool isSelfTargetFrameName(StringView);
+bool isTopTargetFrameName(StringView);
+
} // namespace WebCore
#if ENABLE(TREE_DEBUGGING)
Modified: trunk/Source/WebCore/svg/SVGAElement.cpp (285037 => 285038)
--- trunk/Source/WebCore/svg/SVGAElement.cpp 2021-10-29 17:20:54 UTC (rev 285037)
+++ trunk/Source/WebCore/svg/SVGAElement.cpp 2021-10-29 17:27:20 UTC (rev 285038)
@@ -136,7 +136,7 @@
String target = this->target();
if (target.isEmpty() && attributeWithoutSynchronization(XLinkNames::showAttr) == "new")
- target = "_blank";
+ target = blankTargetFrameName();
event.setDefaultHandled();
RefPtr frame = document().frame();