tor-browser

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

commit c3ed8dfe4cfbbc5a778a02da76ed80070119ac1b
parent 2a49b7ce7630ebf1e6f3cfc2a5fd2230d6dc1366
Author: Manuel Bucher <manuel@mozilla.com>
Date:   Fri, 31 Oct 2025 15:54:26 +0000

Bug 1926551 - Introduce shim for login issue with artstation website r=webcompat-reviewers,timhuang,twisniewski

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

Diffstat:
Mbrowser/extensions/webcompat/data/shims.js | 14++++++++++++++
Mbrowser/extensions/webcompat/manifest.json | 1+
Abrowser/extensions/webcompat/shims/artstationLogin.js | 36++++++++++++++++++++++++++++++++++++
3 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/browser/extensions/webcompat/data/shims.js b/browser/extensions/webcompat/data/shims.js @@ -160,6 +160,20 @@ const AVAILABLE_SHIMS = [ onlyIfBlockedByETP: true, }, { + id: "ArtstationLogin", + platform: "all", + name: "Artstation Google Login", + bug: "1926551", + contentScripts: [ + { + js: "artstationLogin.js", + matches: ["*://www.artstation.com/*"], + runAt: "document_start", + }, + ], + onlyIfDFPIActive: true, + }, + { id: "BmAuth", platform: "all", name: "BmAuth by 9c9media", diff --git a/browser/extensions/webcompat/manifest.json b/browser/extensions/webcompat/manifest.json @@ -111,6 +111,7 @@ "shims/adnexus-prebid.js", "shims/adsafeprotected-ima.js", "shims/apstag.js", + "shims/artstationLogin.js", "shims/bmauth.js", "shims/botd.mjs", "shims/branch.js", diff --git a/browser/extensions/webcompat/shims/artstationLogin.js b/browser/extensions/webcompat/shims/artstationLogin.js @@ -0,0 +1,36 @@ +/* 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"; + +console.warn( + `When logging in, Firefox calls the Storage Access API on behalf of the site. See https://bugzilla.mozilla.org/show_bug.cgi?id=1926551 for details.` +); + +// Third-party origin we need to request storage access for. +const STORAGE_ACCESS_ORIGIN = "https://accounts.google.com"; + +document.documentElement.addEventListener( + "click", + e => { + const { target, isTrusted } = e; + if (!isTrusted) { + return; + } + const loginElement = target.closest("btn.js-google-login-button"); + if (!loginElement) { + return; + } + + console.warn( + "Calling the Storage Access API on behalf of " + STORAGE_ACCESS_ORIGIN + ); + e.stopPropagation(); + e.preventDefault(); + document.requestStorageAccessForOrigin(STORAGE_ACCESS_ORIGIN).then(() => { + target.click(); + }); + }, + true +);