Skip to content

Commit

Permalink
Remove unused BlankAnchorTargetImpliesNoOpenerEnabled
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=247962
<rdar://problem/102390126>

Reviewed by Timothy Hatcher.

We added a feature flag years ago to enable us to A/B test this behavior and
debug site issues. In the years since, the spec and other browsers have aligned
on this behavior and we no longer need this flag.

* Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml:
* Source/WebCore/html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::handleClick):
* Source/WebCore/html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submit):

Canonical link: https://commits.webkit.org/257075@main
  • Loading branch information
brentfulgham authored and Brent Fulgham committed Nov 28, 2022
1 parent d4e923b commit 32f5078
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
12 changes: 0 additions & 12 deletions Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
Expand Up @@ -142,18 +142,6 @@ AudioDescriptionsEnabled:
WebCore:
default: false

BlankAnchorTargetImpliesNoOpenerEnabled:
type: bool
humanReadableName: "Blank anchor target implies rel=noopener"
humanReadableDescription: "target=_blank on anchor elements implies rel=noopener"
defaultValue:
WebKitLegacy:
default: true
WebKit:
default: true
WebCore:
default: true

# We would have to partition BroadcastChannel based on PageGroups if we wanted to enable this for WebKitLegacy.
BroadcastChannelEnabled:
type: bool
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/HTMLAnchorElement.cpp
Expand Up @@ -604,7 +604,7 @@ void HTMLAnchorElement::handleClick(Event& event)

auto effectiveTarget = this->effectiveTarget();
NewFrameOpenerPolicy newFrameOpenerPolicy = NewFrameOpenerPolicy::Allow;
if (hasRel(Relation::NoOpener) || hasRel(Relation::NoReferrer) || (!hasRel(Relation::Opener) && document().settings().blankAnchorTargetImpliesNoOpenerEnabled() && isBlankTargetFrameName(effectiveTarget) && !completedURL.protocolIsJavaScript()))
if (hasRel(Relation::NoOpener) || hasRel(Relation::NoReferrer) || (!hasRel(Relation::Opener) && isBlankTargetFrameName(effectiveTarget) && !completedURL.protocolIsJavaScript()))
newFrameOpenerPolicy = NewFrameOpenerPolicy::Suppress;

auto privateClickMeasurement = parsePrivateClickMeasurement(completedURL);
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/HTMLFormElement.cpp
Expand Up @@ -444,7 +444,7 @@ void HTMLFormElement::submit(Event* event, bool processingUserGesture, FormSubmi
return;

auto relAttributes = parseFormRelAttributes(getAttribute(HTMLNames::relAttr));
if (relAttributes.noopener || relAttributes.noreferrer || (!relAttributes.opener && document().settings().blankAnchorTargetImpliesNoOpenerEnabled() && isBlankTargetFrameName(formSubmission->target()) && !formSubmission->requestURL().protocolIsJavaScript()))
if (relAttributes.noopener || relAttributes.noreferrer || (!relAttributes.opener && isBlankTargetFrameName(formSubmission->target()) && !formSubmission->requestURL().protocolIsJavaScript()))
formSubmission->setNewFrameOpenerPolicy(NewFrameOpenerPolicy::Suppress);
if (relAttributes.noreferrer)
formSubmission->setReferrerPolicy(ReferrerPolicy::NoReferrer);
Expand Down

0 comments on commit 32f5078

Please sign in to comment.