tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 8c4e3f2cc636360958cafd23adc1b22eacc98fb7
parent b36280af65b4b62caf2195c77e36c0a213731751
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date:   Wed,  5 Nov 2025 18:20:15 +0000

Bug 1993517 - add a webcompat JS intervention for onlinebank.resursbank.se; r=webcompat-reviewers,ksenia

Differential Revision: https://phabricator.services.mozilla.com/D271265

Diffstat:
Mbrowser/extensions/webcompat/data/interventions.json | 17+++++++++++++++++
Abrowser/extensions/webcompat/injections/js/bug1993517-onlinebank.resursbank.se-autoclose-bankid-tabs.js | 31+++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/interventions.json b/browser/extensions/webcompat/data/interventions.json @@ -5813,6 +5813,23 @@ } ] }, + "1993517": { + "label": "onlinebank.resursbank.se", + "bugs": { + "1993517": { + "issue": "page-fails-to-load", + "matches": ["*://onlinebank.resursbank.se/*"] + } + }, + "interventions": [ + { + "platforms": ["desktop"], + "content_scripts": { + "js": ["bug1993517-onlinebank.resursbank.se-autoclose-bankid-tabs.js"] + } + } + ] + }, "1994062": { "label": "managetrips.jetblue.com", "bugs": { diff --git a/browser/extensions/webcompat/injections/js/bug1993517-onlinebank.resursbank.se-autoclose-bankid-tabs.js b/browser/extensions/webcompat/injections/js/bug1993517-onlinebank.resursbank.se-autoclose-bankid-tabs.js @@ -0,0 +1,31 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +/* globals exportFunction */ + +/** + * Bug 1993517 - onlinebank.resursbank.se - extra browser tabs for bankid logins remain open + * + * We can open the external app link in the same tab rather than a _blank tab. + * Chrome and Safari seem to autoclose such tabs incorrectly. + */ + +console.info( + 'Dropping target="_blank" attribute for bankid logins for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1993517 for details.' +); + +if (/Win32|Win64|Windows|WinCE/i.test(navigator.platform)) { + const nav = Object.getPrototypeOf(navigator.wrappedJSObject); + const platform = Object.getOwnPropertyDescriptor(nav, "platform"); + platform.get = exportFunction(() => "MacIntel", window); + Object.defineProperty(nav, "platform", platform); +} + +document.addEventListener( + "click", + e => e.target?.closest("a[href^='bankid://']")?.removeAttribute("target"), + true +);