diff --git a/browser/extensions/webcompat/data/injections.js b/browser/extensions/webcompat/data/injections.js index b8d89ae9d65a..142e2fd93e88 100644 --- a/browser/extensions/webcompat/data/injections.js +++ b/browser/extensions/webcompat/data/injections.js @@ -1316,6 +1316,20 @@ const AVAILABLE_INJECTIONS = [ ], }, }, + { + id: "bug1950282", + platform: "linux", + domain: "formula1.com", + bug: "1950282", + contentScripts: { + matches: ["*://*.formula1.com/*"], + js: [ + { + file: "injections/js/bug1950282-formula1.com-platform-linux-fix.js", + }, + ], + }, + }, ]; module.exports = AVAILABLE_INJECTIONS; diff --git a/browser/extensions/webcompat/data/ua_overrides.js b/browser/extensions/webcompat/data/ua_overrides.js index 21d8d9271279..a9463ac146f6 100644 --- a/browser/extensions/webcompat/data/ua_overrides.js +++ b/browser/extensions/webcompat/data/ua_overrides.js @@ -1458,6 +1458,24 @@ const AVAILABLE_UA_OVERRIDES = [ }, }, }, + { + /* + * Bug 1950282 - UA override for formula1.com + * Webcompat issue #149085 - https://webcompat.com/issues/149085 + * + * Site blocks Firefox, but works with a UA spoof. + */ + id: "1950282", + platform: "all", + domain: "formula1.com", + bug: "1950282", + config: { + matches: ["*://*.formula1.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, ]; module.exports = AVAILABLE_UA_OVERRIDES; diff --git a/browser/extensions/webcompat/injections/js/bug1950282-formula1.com-platform-linux-fix.js b/browser/extensions/webcompat/injections/js/bug1950282-formula1.com-platform-linux-fix.js new file mode 100644 index 000000000000..24f4fcd5caf5 --- /dev/null +++ b/browser/extensions/webcompat/injections/js/bug1950282-formula1.com-platform-linux-fix.js @@ -0,0 +1,27 @@ +/* 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"; + +/** + * Bug 1472075 - Build UA override for Bank of America for OSX & Linux + * + * Formula1 TV is doing some kind of check for Android devices which is + * causing it to treat Firefox on Linux as an Android device, and blocking it. + * Overriding navigator.platform to Win64 on Linux works around this issue. + */ + +/* globals exportFunction */ + +console.info( + "navigator.platform has been overridden for compatibility reasons. See https://bugzilla.mozilla.org/show_bug.cgi?id=1950282 for details." +); + +Object.defineProperty(window.navigator.wrappedJSObject, "platform", { + get: exportFunction(function () { + return "Win64"; + }, window), + + set: exportFunction(function () {}, window), +}); diff --git a/browser/extensions/webcompat/manifest.json b/browser/extensions/webcompat/manifest.json index 5b42c6c2caca..aa7a241a8089 100644 --- 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": "133.3.0", + "version": "133.4.0", "browser_specific_settings": { "gecko": { "id": "webcompat@mozilla.org", diff --git a/browser/extensions/webcompat/moz.build b/browser/extensions/webcompat/moz.build index c8eb53800613..14fa9aba06f5 100644 --- a/browser/extensions/webcompat/moz.build +++ b/browser/extensions/webcompat/moz.build @@ -120,6 +120,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [ "injections/js/bug1898952-digits.t-mobile.com.js", "injections/js/bug1899937-plus.nhk.jp-request-picture-in-picture.js", "injections/js/bug1924500-www.tiktok.com-fix-captcha-slider.js", + "injections/js/bug1950282-formula1.com-platform-linux-fix.js", ] FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["shims"] += [