Description: This patch prevents hyperlinks that have a target="_blank"
attribute from automatically opening in a new tab.
Author: Soren Stoutner <soren@stoutner.com>
Forwarded: not-needed
Last-Update: 2023-05-20
--- a/src/3rdparty/chromium/third_party/blink/renderer/core/html/html_anchor_element.cc
+++ b/src/3rdparty/chromium/third_party/blink/renderer/core/html/html_anchor_element.cc
@@ -541,11 +541,14 @@
 
   frame->MaybeLogAdClickNavigation();
 
+  // Patching this function to use the base target for both empty targets and "_blank"
+  // causes hyperlinks that used to open in a new tab by default to instead default
+  // to opening in the current tab.
   Frame* target_frame =
       frame->Tree()
           .FindOrCreateFrameForNavigation(
               frame_request,
-              target.IsEmpty() ? GetDocument().BaseTarget() : target)
+              (target.IsEmpty() || (target == "_blank")) ? GetDocument().BaseTarget() : target)
           .frame;
 
   // If hrefTranslate is enabled and set restrict processing it
