commit c4985ebc9b0658298452c40de8efb000781064ac
parent c3ed8dfe4cfbbc5a778a02da76ed80070119ac1b
Author: Thomas Wisniewski <twisniewski@mozilla.com>
Date: Fri, 31 Oct 2025 15:54:26 +0000
Bug 1993727 - Introduce a shim script to fix the login issue for the CambridgeDictionary website. r=twisniewski,webcompat-reviewers,manuel
Differential Revision: https://phabricator.services.mozilla.com/D270704
Diffstat:
3 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/browser/extensions/webcompat/data/shims.js b/browser/extensions/webcompat/data/shims.js
@@ -649,6 +649,20 @@ const AVAILABLE_SHIMS = [
onlyIfDFPIActive: true,
},
{
+ id: "CambridgeDictionaryLogin",
+ platform: "all",
+ name: "Cambridge Dictionary Google Login",
+ bug: "1993727",
+ contentScripts: [
+ {
+ js: "cambridgeDictionaryLogin.js",
+ matches: ["*://dictionary.cambridge.org/*"],
+ runAt: "document_start",
+ },
+ ],
+ onlyIfDFPIActive: true,
+ },
+ {
id: "MicrosoftOfficeAuth",
platform: "desktop",
name: "Microsoft Office Auth",
diff --git a/browser/extensions/webcompat/manifest.json b/browser/extensions/webcompat/manifest.json
@@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
- "version": "146.5.0",
+ "version": "146.6.0",
"browser_specific_settings": {
"gecko": {
"id": "webcompat@mozilla.org",
@@ -115,6 +115,7 @@
"shims/bmauth.js",
"shims/botd.mjs",
"shims/branch.js",
+ "shims/cambridgeDictionaryLogin.js",
"shims/chartbeat.js",
"shims/crave-ca.js",
"shims/criteo.js",
diff --git a/browser/extensions/webcompat/shims/cambridgeDictionaryLogin.js b/browser/extensions/webcompat/shims/cambridgeDictionaryLogin.js
@@ -0,0 +1,38 @@
+/* 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=1993727 for details.`
+);
+
+// Third-party origin we need to request storage access for.
+const STORAGE_ACCESS_ORIGIN = "https://accounts.eu1.gigya.com";
+
+document.documentElement.addEventListener(
+ "click",
+ e => {
+ const { target, isTrusted } = e;
+ if (!isTrusted) {
+ return;
+ }
+ const loginElement = target.closest(
+ "span.cdo-login-button, span.cdo-register-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
+);