diff options
Diffstat (limited to 'browser/extensions/webcompat/data')
-rw-r--r-- | browser/extensions/webcompat/data/injections.js | 467 | ||||
-rw-r--r-- | browser/extensions/webcompat/data/picture_in_picture_overrides.js | 60 | ||||
-rw-r--r-- | browser/extensions/webcompat/data/shims.js | 253 | ||||
-rw-r--r-- | browser/extensions/webcompat/data/ua_overrides.js | 686 |
4 files changed, 1466 insertions, 0 deletions
diff --git a/browser/extensions/webcompat/data/injections.js b/browser/extensions/webcompat/data/injections.js new file mode 100644 index 0000000000..d97deca4d6 --- /dev/null +++ b/browser/extensions/webcompat/data/injections.js @@ -0,0 +1,467 @@ +/* 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 module, require */ + +// This is a hack for the tests. +if (typeof InterventionHelpers === "undefined") { + var InterventionHelpers = require("../lib/intervention_helpers"); +} + +/** + * For detailed information on our policies, and a documention on this format + * and its possibilites, please check the Mozilla-Wiki at + * + * https://wiki.mozilla.org/Compatibility/Go_Faster_Addon/Override_Policies_and_Workflows#User_Agent_overrides + */ +const AVAILABLE_INJECTIONS = [ + { + id: "testbed-injection", + platform: "all", + domain: "webcompat-addon-testbed.herokuapp.com", + bug: "0000000", + hidden: true, + contentScripts: { + matches: ["*://webcompat-addon-testbed.herokuapp.com/*"], + css: [ + { + file: "injections/css/bug0000000-testbed-css-injection.css", + }, + ], + js: [ + { + file: "injections/js/bug0000000-testbed-js-injection.js", + }, + ], + }, + }, + { + id: "bug1452707", + platform: "desktop", + domain: "ib.absa.co.za", + bug: "1452707", + contentScripts: { + matches: ["https://ib.absa.co.za/*"], + js: [ + { + file: + "injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js", + }, + ], + }, + }, + { + id: "bug1457335", + platform: "desktop", + domain: "histography.io", + bug: "1457335", + contentScripts: { + matches: ["*://histography.io/*"], + js: [ + { + file: "injections/js/bug1457335-histography.io-ua-change.js", + }, + ], + }, + }, + { + id: "bug1472075", + platform: "desktop", + domain: "bankofamerica.com", + bug: "1472075", + contentScripts: { + matches: ["*://*.bankofamerica.com/*"], + js: [ + { + file: "injections/js/bug1472075-bankofamerica.com-ua-change.js", + }, + ], + }, + }, + { + id: "bug1570856", + platform: "android", + domain: "medium.com", + bug: "1570856", + contentScripts: { + matches: ["*://medium.com/*"], + js: [ + { + file: "injections/js/bug1570856-medium.com-menu-isTier1.js", + }, + ], + allFrames: true, + }, + }, + { + id: "bug1579159", + platform: "android", + domain: "m.tailieu.vn", + bug: "1579159", + contentScripts: { + matches: ["*://m.tailieu.vn/*", "*://m.elib.vn/*"], + js: [ + { + file: "injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js", + }, + ], + allFrames: true, + }, + }, + { + id: "bug1551672", + platform: "android", + domain: "Sites using PDK 5 video", + bug: "1551672", + data: { + urls: ["https://*/*/tpPdk.js", "https://*/*/pdk/js/*/*.js"], + types: ["script"], + }, + customFunc: "pdk5fix", + }, + { + id: "bug1583366", + platform: "desktop", + domain: "Download prompt for files with no content-type", + bug: "1583366", + data: { + urls: ["https://ads-us.rd.linksynergy.com/as.php*"], + contentType: { + name: "content-type", + value: "text/html; charset=utf-8", + }, + }, + customFunc: "noSniffFix", + }, + { + id: "bug1561371", + platform: "android", + domain: "mail.google.com", + bug: "1561371", + contentScripts: { + matches: ["*://mail.google.com/*"], + css: [ + { + file: + "injections/css/bug1561371-mail.google.com-allow-horizontal-scrolling.css", + }, + ], + }, + }, + { + id: "bug1570119", + platform: "desktop", + domain: "teamcoco.com", + bug: "1570119", + contentScripts: { + matches: ["*://teamcoco.com/*"], + css: [ + { + file: "injections/css/bug1570119-teamcoco.com-scrollbar-width.css", + }, + ], + }, + }, + { + id: "bug1570328", + platform: "android", + domain: "developer.apple.com", + bug: "1570328", + contentScripts: { + matches: ["*://developer.apple.com/*"], + css: [ + { + file: + "injections/css/bug1570328-developer-apple.com-transform-scale.css", + }, + ], + }, + }, + { + id: "bug1575000", + platform: "all", + domain: "apply.lloydsbank.co.uk", + bug: "1575000", + contentScripts: { + matches: ["*://apply.lloydsbank.co.uk/*"], + css: [ + { + file: + "injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.css", + }, + ], + }, + }, + { + id: "bug1605611", + platform: "android", + domain: "maps.google.com", + bug: "1605611", + contentScripts: { + matches: InterventionHelpers.matchPatternsForGoogle( + "*://www.google.", + "/maps*" + ), + css: [ + { + file: "injections/css/bug1605611-maps.google.com-directions-time.css", + }, + ], + js: [ + { + file: "injections/js/bug1605611-maps.google.com-directions-time.js", + }, + ], + }, + }, + { + id: "bug1610016", + platform: "android", + domain: "gaana.com", + bug: "1610016", + contentScripts: { + matches: ["https://gaana.com/*"], + css: [ + { + file: "injections/css/bug1610016-gaana.com-input-position-fix.css", + }, + ], + }, + }, + { + id: "bug1610358", + platform: "android", + domain: "pcloud.com", + bug: "1610358", + contentScripts: { + matches: ["https://www.pcloud.com/*"], + js: [ + { + file: "injections/js/bug1610358-pcloud.com-appVersion-change.js", + }, + ], + }, + }, + { + id: "bug1610344", + platform: "all", + domain: "directv.com.co", + bug: "1610344", + contentScripts: { + matches: ["https://*.directv.com.co/*"], + css: [ + { + file: + "injections/css/bug1610344-directv.com.co-hide-unsupported-message.css", + }, + ], + }, + }, + { + id: "bug1622062", + platform: "android", + domain: "$.detectSwipe fix", + bug: "1622062", + data: { + urls: ["https://eu.stemwijzer.nl/public/js/votematch.vendors.js"], + types: ["script"], + }, + customFunc: "detectSwipeFix", + }, + { + id: "bug1644830", + platform: "desktop", + domain: "usps.com", + bug: "1644830", + contentScripts: { + matches: ["https://*.usps.com/*"], + css: [ + { + file: + "injections/css/bug1644830-missingmail.usps.com-checkboxes-not-visible.css", + }, + ], + }, + }, + { + id: "bug1645064", + platform: "desktop", + domain: "s-kanava.fi", + bug: "1645064", + contentScripts: { + matches: ["https://www.s-kanava.fi/*"], + css: [ + { + file: "injections/css/bug1645064-s-kanava.fi-invisible-charts.css", + }, + ], + }, + }, + { + id: "bug1651917", + platform: "android", + domain: "teletrader.com", + bug: "1651917", + contentScripts: { + matches: ["*://*.teletrader.com/*"], + css: [ + { + file: + "injections/css/bug1651917-teletrader.com.body-transform-origin.css", + }, + ], + }, + }, + { + id: "bug1653075", + platform: "desktop", + domain: "livescience.com", + bug: "1653075", + contentScripts: { + matches: ["*://*.livescience.com/*"], + css: [ + { + file: "injections/css/bug1653075-livescience.com-scrollbar-width.css", + }, + ], + }, + }, + { + id: "bug1654865", + platform: "android", + domain: "sports.ndtv.com", + bug: "1654865", + contentScripts: { + matches: ["*://sports.ndtv.com/*"], + css: [ + { + file: "injections/css/bug1654865-sports.ndtv.com-float-fix.css", + }, + ], + }, + }, + { + id: "bug1654877", + platform: "android", + domain: "preev.com", + bug: "1654877", + contentScripts: { + matches: ["*://preev.com/*"], + css: [ + { + file: "injections/css/bug1654877-preev.com-moz-appearance-fix.css", + }, + ], + }, + }, + { + id: "bug1655049", + platform: "android", + domain: "dev.to", + bug: "1655049", + contentScripts: { + matches: ["*://dev.to/*"], + css: [ + { + file: "injections/css/bug1655049-dev.to-unclickable-button-fix.css", + }, + ], + }, + }, + { + id: "bug1654907", + platform: "android", + domain: "reactine.ca", + bug: "1654907", + contentScripts: { + matches: ["*://*.reactine.ca/*"], + css: [ + { + file: "injections/css/bug1654907-reactine.ca-hide-unsupported.css", + }, + ], + }, + }, + { + id: "bug1666771", + platform: "desktop", + domain: "zillow.com", + bug: "1666771", + contentScripts: { + allFrames: true, + matches: ["*://*.zillow.com/*"], + css: [ + { + file: "injections/css/bug1666771-zilow-map-overdraw.css", + }, + ], + }, + }, + { + id: "bug1631811", + platform: "all", + domain: "datastudio.google.com", + bug: "1631811", + contentScripts: { + matches: ["https://datastudio.google.com/embed/reporting/*"], + js: [ + { + file: "injections/js/bug1631811-datastudio.google.com-indexedDB.js", + }, + ], + allFrames: true, + }, + }, + { + id: "bug1665035", + platform: "desktop", + domain: "dckids.com", + bug: "1665035", + contentScripts: { + matches: [ + "https://d3qlaywcwingl6.cloudfront.net/content/*/Html5Game/*", + "https://d3qlaywcwingl6.cloudfront.net/*/game/content/*", + ], + js: [ + { + file: "injections/js/bug1665035-dckids.com-cookieEnabled.js", + }, + ], + allFrames: true, + }, + }, + { + id: "bug1677442", + platform: "desktop", + domain: "store.hp.com", + bug: "1677442", + contentScripts: { + matches: ["*://d3nkfb7815bs43.cloudfront.net/*forstore.hp.com*"], + js: [ + { + file: "injections/js/bug1677442-store.hp.com-disable-indexeddb.js", + }, + ], + allFrames: true, + }, + }, + { + id: "bug1682238", + platform: "desktop", + domain: "gamearter.com", + bug: "1682238", + contentScripts: { + matches: ["*://*.gamearter.com/*"], + js: [ + { + file: "injections/js/bug1682238-gamearter.com-ua-change.js", + }, + ], + }, + }, +]; + +module.exports = AVAILABLE_INJECTIONS; diff --git a/browser/extensions/webcompat/data/picture_in_picture_overrides.js b/browser/extensions/webcompat/data/picture_in_picture_overrides.js new file mode 100644 index 0000000000..e9a4e88657 --- /dev/null +++ b/browser/extensions/webcompat/data/picture_in_picture_overrides.js @@ -0,0 +1,60 @@ +/* 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 browser */ + +let AVAILABLE_PIP_OVERRIDES; + +{ + // See PictureInPictureControls.jsm for these values. + // eslint-disable-next-line no-unused-vars + const TOGGLE_POLICIES = browser.pictureInPictureChild.getPolicies(); + const KEYBOARD_CONTROLS = browser.pictureInPictureChild.getKeyboardControls(); + + AVAILABLE_PIP_OVERRIDES = { + // The keys of this object are match patterns for URLs, as documented in + // https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns + // + // Example: + // + // "https://*.youtube.com/*": { + // policy: TOGGLE_POLICIES.THREE_QUARTERS, + // keyboardControls: KEYBOARD_CONTROLS.PLAY_PAUSE | KEYBOARD_CONTROLS.VOLUME, + // }, + // "https://*.twitch.tv/mikeconley_dot_ca/*": { + // policy: TOGGLE_POLICIES.TOP, + // keyboardControls: KEYBOARD_CONTROLS.NONE, + // }, + + instagram: { + "https://www.instagram.com/*": { policy: TOGGLE_POLICIES.ONE_QUARTER }, + }, + + laracasts: { + "https://*.laracasts.com/*": { policy: TOGGLE_POLICIES.ONE_QUARTER }, + }, + + netflix: { + "https://*.netflix.com/*": { keyboardControls: ~KEYBOARD_CONTROLS.SEEK }, + "https://*.netflix.com/browse": { policy: TOGGLE_POLICIES.HIDDEN }, + "https://*.netflix.com/latest": { policy: TOGGLE_POLICIES.HIDDEN }, + }, + + twitch: { + "https://*.twitch.tv/*": { policy: TOGGLE_POLICIES.ONE_QUARTER }, + "https://*.twitch.tech/*": { policy: TOGGLE_POLICIES.ONE_QUARTER }, + "https://*.twitch.a2z.com/*": { policy: TOGGLE_POLICIES.ONE_QUARTER }, + }, + + udemy: { + "https://*.udemy.com/*": { policy: TOGGLE_POLICIES.ONE_QUARTER }, + }, + + youtube: { + "https://*.youtube.com/*": { visibilityThreshold: 0.9 }, + }, + }; +} diff --git a/browser/extensions/webcompat/data/shims.js b/browser/extensions/webcompat/data/shims.js new file mode 100644 index 0000000000..8abdffac39 --- /dev/null +++ b/browser/extensions/webcompat/data/shims.js @@ -0,0 +1,253 @@ +/* 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 module, require */ + +const AVAILABLE_SHIMS = [ + { + id: "LiveTestShim", + platform: "all", + name: "Live test shim", + bug: "livetest", + file: "live-test-shim.js", + matches: ["*://webcompat-addon-testbed.herokuapp.com/shims_test.js"], + needsShimHelpers: ["getOptions", "optIn"], + }, + { + id: "MochitestShim", + platform: "all", + name: "Test shim for Mochitests", + bug: "mochitest", + file: "mochitest-shim-1.js", + matches: [ + "*://example.com/browser/browser/extensions/webcompat/tests/browser/shims_test.js", + ], + needsShimHelpers: ["getOptions", "optIn"], + options: { + simpleOption: true, + complexOption: { a: 1, b: "test" }, + branchValue: { value: true, branches: [] }, + platformValue: { value: true, platform: "neverUsed" }, + }, + unblocksOnOptIn: ["*://trackertest.org/*"], + }, + { + disabled: true, + id: "MochitestShim2", + platform: "all", + name: "Test shim for Mochitests (disabled by default)", + bug: "mochitest", + file: "mochitest-shim-2.js", + matches: [ + "*://example.com/browser/browser/extensions/webcompat/tests/browser/shims_test_2.js", + ], + needsShimHelpers: ["getOptions", "optIn"], + options: { + simpleOption: true, + complexOption: { a: 1, b: "test" }, + branchValue: { value: true, branches: [] }, + platformValue: { value: true, platform: "neverUsed" }, + }, + unblocksOnOptIn: ["*://trackertest.org/*"], + }, + { + id: "MochitestShim3", + platform: "all", + name: "Test shim for Mochitests (host)", + bug: "mochitest", + file: "mochitest-shim-3.js", + notHosts: ["example.com"], + matches: [ + "*://example.com/browser/browser/extensions/webcompat/tests/browser/shims_test_3.js", + ], + }, + { + id: "MochitestShim4", + platform: "all", + name: "Test shim for Mochitests (notHost)", + bug: "mochitest", + file: "mochitest-shim-3.js", + hosts: ["example.net"], + matches: [ + "*://example.com/browser/browser/extensions/webcompat/tests/browser/shims_test_3.js", + ], + }, + { + id: "MochitestShim5", + platform: "all", + name: "Test shim for Mochitests (branch)", + bug: "mochitest", + file: "mochitest-shim-3.js", + branches: ["never matches"], + matches: [ + "*://example.com/browser/browser/extensions/webcompat/tests/browser/shims_test_3.js", + ], + }, + { + id: "MochitestShim6", + platform: "never matches", + name: "Test shim for Mochitests (platform)", + bug: "mochitest", + file: "mochitest-shim-3.js", + matches: [ + "*://example.com/browser/browser/extensions/webcompat/tests/browser/shims_test_3.js", + ], + }, + { + id: "AdSafeProtectedGoogleIMAAdapter", + platform: "all", + branches: ["nightly"], + name: "Ad Safe Protected Google IMA Adapter", + bug: "1508639", + file: "adsafeprotected-ima.js", + matches: ["*://static.adsafeprotected.com/vans-adapter-google-ima.js"], + needsShimHelpers: ["optIn"], + onlyIfBlockedByETP: true, + unblocksOnOptIn: ["*://pubads.g.doubleclick.net/gampad/ads"], + }, + { + id: "AdsByGoogle", + platform: "all", + branches: ["nightly"], + name: "Ads by Google", + bug: "1629644", + file: "empty-script.js", + matches: ["*://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"], + onlyIfBlockedByETP: true, + }, + { + id: "BmAuth", + platform: "all", + branches: ["nightly"], + name: "BmAuth by 9c9media", + bug: "1486337", + file: "bmauth.js", + matches: ["*://auth.9c9media.ca/auth/main.js"], + onlyIfBlockedByETP: true, + }, + { + id: "Eluminate", + platform: "all", + branches: ["nightly"], + name: "Eluminate", + bug: "1503211", + file: "eluminate.js", + matches: ["*://libs.coremetrics.com/eluminate.js"], + onlyIfBlockedByETP: true, + }, + { + id: "FacebookSDK", + platform: "all", + branches: ["nightly"], + name: "Facebook SDK", + bug: "1226498", + file: "facebook-sdk.js", + matches: [ + "*://connect.facebook.net/*/sdk.js*", + "*://connect.facebook.net/*/all.js*", + ], + needsShimHelpers: ["optIn"], + onlyIfBlockedByETP: true, + unblocksOnOptIn: [ + "*://*.xx.fbcdn.net/*", // covers: + // "*://scontent-.*-\d.xx.fbcdn.net/*", + // "*://static.xx.fbcdn.net/rsrc.php/*", + + "*://www.facebook.com/plugins/comments.php*", + "*://www.facebook.com/plugins/comments/async/*", + "*://www.facebook.com/plugins/feedback.php*", + "*://www.facebook.com/plugins/like_box.php*", + ], + }, + { + id: "GoogleAnalytics", + platform: "all", + branches: ["nightly"], + name: "Google Analytics", + bug: "1493602", + file: "google-analytics.js", + matches: ["*://www.google-analytics.com/analytics.js"], + onlyIfBlockedByETP: true, + }, + { + id: "GoogleAnalyticsECommercePlugin", + platform: "all", + branches: ["nightly"], + name: "Google Analytics E-Commerce Plugin", + bug: "1620533", + file: "google-analytics-ecommerce-plugin.js", + matches: ["*://www.google-analytics.com/plugins/ua/ec.js"], + onlyIfBlockedByETP: true, + }, + { + id: "GoogleAnalyticsTagManager", + platform: "all", + branches: ["nightly"], + name: "Google Analytics Tag Manager", + bug: "1478593", + file: "google-analytics-tag-manager.js", + matches: ["*://www.google-analytics.com/gtm/js"], + onlyIfBlockedByETP: true, + }, + { + id: "GoogleAnalyticsLegacy", + platform: "all", + branches: ["nightly"], + name: "Legacy Google Analytics", + bug: "1487072", + file: "google-analytics-legacy.js", + matches: ["*://ssl.google-analytics.com/ga.js"], + onlyIfBlockedByETP: true, + }, + { + id: "GooglePublisherTags", + platform: "all", + branches: ["nightly"], + name: "Google Publisher Tags", + bug: "1600538", + file: "google-publisher-tags.js", + matches: [ + "*://www.googletagservices.com/tag/js/gpt.js", + "*://securepubads.g.doubleclick.net/tag/js/gpt.js", + "*://securepubads.g.doubleclick.net/gpt/pubads_impl_*.js", + ], + onlyIfBlockedByETP: true, + unblocksOnOptIn: ["*://pubads.g.doubleclick.net/ssai/event/*/streams"], + }, + { + id: "IMA3", + platform: "all", + branches: ["nightly"], + name: "IMA3", + bug: "1487373", + file: "empty-script.js", + onlyIfBlockedByETP: true, + matches: ["*://s0.2mdn.net/instream/html5/ima3.js"], + }, + { + id: "Rambler", + platform: "all", + branches: ["nightly"], + name: "Rambler Authenticator", + bug: "1606428", + file: "rambler-authenticator.js", + matches: ["*://id.rambler.ru/rambler-id-helper/auth_events.js"], + needsShimHelpers: ["optIn"], + onlyIfBlockedByETP: true, + }, + { + id: "RichRelevance", + platform: "all", + branches: ["nightly"], + name: "Rich Relevance", + bug: "1449347", + file: "rich-relevance.js", + matches: ["*://media.richrelevance.com/rrserver/js/1.2/p13n.js"], + onlyIfBlockedByETP: true, + }, +]; + +module.exports = AVAILABLE_SHIMS; diff --git a/browser/extensions/webcompat/data/ua_overrides.js b/browser/extensions/webcompat/data/ua_overrides.js new file mode 100644 index 0000000000..daa947989c --- /dev/null +++ b/browser/extensions/webcompat/data/ua_overrides.js @@ -0,0 +1,686 @@ +/* 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 browser, module, require */ + +// This is a hack for the tests. +if (typeof InterventionHelpers === "undefined") { + var InterventionHelpers = require("../lib/intervention_helpers"); +} + +/** + * For detailed information on our policies, and a documention on this format + * and its possibilites, please check the Mozilla-Wiki at + * + * https://wiki.mozilla.org/Compatibility/Go_Faster_Addon/Override_Policies_and_Workflows#User_Agent_overrides + */ +const AVAILABLE_UA_OVERRIDES = [ + { + id: "testbed-override", + platform: "all", + domain: "webcompat-addon-testbed.herokuapp.com", + bug: "0000000", + config: { + hidden: true, + matches: ["*://webcompat-addon-testbed.herokuapp.com/*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36 for WebCompat" + ); + }, + }, + }, + { + /* + * Bug 1577519 - att.tv - Create a UA override for att.tv for playback on desktop + * WebCompat issue #3846 - https://webcompat.com/issues/3846 + * + * att.tv (atttvnow.com) is blocking Firefox via UA sniffing. Spoofing as Chrome allows + * to access the site and playback works fine. This is former directvnow.com + */ + id: "bug1577519", + platform: "desktop", + domain: "att.tv", + bug: "1577519", + config: { + matches: ["*://*.att.tv/*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" + ); + }, + }, + }, + { + /* + * Bug 1570108 - steamcommunity.com - UA override for steamcommunity.com + * WebCompat issue #34171 - https://webcompat.com/issues/34171 + * + * steamcommunity.com blocks chat feature for Firefox users showing unsupported browser message. + * When spoofing as Chrome the chat works fine + */ + id: "bug1570108", + platform: "desktop", + domain: "steamcommunity.com", + bug: "1570108", + config: { + matches: ["*://steamcommunity.com/chat*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36" + ); + }, + }, + }, + { + /* + * Bug 1582582 - sling.com - UA override for sling.com + * WebCompat issue #17804 - https://webcompat.com/issues/17804 + * + * sling.com blocks Firefox users showing unsupported browser message. + * When spoofing as Chrome playing content works fine + */ + id: "bug1582582", + platform: "desktop", + domain: "sling.com", + bug: "1582582", + config: { + matches: ["https://watch.sling.com/*", "https://www.sling.com/*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36" + ); + }, + }, + }, + { + /* + * Bug 1610026 - www.mobilesuica.com - UA override for www.mobilesuica.com + * WebCompat issue #4608 - https://webcompat.com/issues/4608 + * + * mobilesuica.com showing unsupported message for Firefox users + * Spoofing as Chrome allows to access the page + */ + id: "bug1610026", + platform: "all", + domain: "www.mobilesuica.com", + bug: "1610026", + config: { + matches: ["https://www.mobilesuica.com/*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36" + ); + }, + }, + }, + { + /* + * Bug 945963 - tieba.baidu.com serves simplified mobile content to Firefox Android + * additionally, Bug 1525839 for more domains + * WebCompat issue #18455 - https://webcompat.com/issues/18455 + * + * tieba.baidu.com and tiebac.baidu.com serve a heavily simplified and less functional + * mobile experience to Firefox for Android users. Adding the AppleWebKit indicator + * to the User Agent gets us the same experience. + */ + id: "bug945963", + platform: "android", + domain: "tieba.baidu.com", + bug: "945963", + config: { + matches: [ + "*://baike.baidu.com/*", + "*://image.baidu.com/*", + "*://news.baidu.com/*", + "*://tieba.baidu.com/*", + "*://tiebac.baidu.com/*", + "*://wenku.baidu.com/*", + "*://zhidao.baidu.com/*", + ], + uaTransformer: originalUA => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1177298 - Write UA overrides for top Japanese Sites + * (Imported from ua-update.json.in) + * + * To receive the proper mobile version instead of the desktop version or + * a lower grade mobile experience, the UA is spoofed. + */ + id: "bug1177298-2", + platform: "android", + domain: "lohaco.jp", + bug: "1177298", + config: { + matches: ["*://*.lohaco.jp/*"], + uaTransformer: _ => { + return "Mozilla/5.0 (Linux; Android 5.0.2; Galaxy Nexus Build/IMM76B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.93 Mobile Safari/537.36"; + }, + }, + }, + { + /* + * Bug 1177298 - Write UA overrides for top Japanese Sites + * (Imported from ua-update.json.in) + * + * To receive the proper mobile version instead of the desktop version or + * a lower grade mobile experience, the UA is spoofed. + */ + id: "bug1177298-3", + platform: "android", + domain: "nhk.or.jp", + bug: "1177298", + config: { + matches: ["*://*.nhk.or.jp/*"], + uaTransformer: originalUA => { + return originalUA + " AppleWebKit"; + }, + }, + }, + { + /* + * Bug 1385206 - Create UA override for rakuten.co.jp on Firefox Android + * (Imported from ua-update.json.in) + * + * rakuten.co.jp serves a Desktop version if Firefox is included in the UA. + */ + id: "bug1385206", + platform: "android", + domain: "rakuten.co.jp", + bug: "1385206", + config: { + matches: ["*://*.rakuten.co.jp/*"], + uaTransformer: originalUA => { + return originalUA.replace(/Firefox.+$/, ""); + }, + }, + }, + { + /* + * Bug 969844 - mobile.de sends desktop site to Firefox on Android + * + * mobile.de sends the desktop site to Firefox Mobile. + * Spoofing as Chrome works fine. + */ + id: "bug969844", + platform: "android", + domain: "mobile.de", + bug: "969844", + config: { + matches: ["*://*.mobile.de/*"], + uaTransformer: _ => { + return "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36"; + }, + }, + }, + { + /* + * Bug 1509831 - cc.com - Add UA override for CC.com + * WebCompat issue #329 - https://webcompat.com/issues/329 + * + * ComedyCentral blocks Firefox for not being able to play HLS, which was + * true in previous versions, but no longer is. With a spoofed Chrome UA, + * the site works just fine. + */ + id: "bug1509831", + platform: "android", + domain: "cc.com", + bug: "1509831", + config: { + matches: ["*://*.cc.com/*"], + uaTransformer: _ => { + return "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36"; + }, + }, + }, + { + /* + * Bug 1509873 - zmags.com - Add UA override for secure.viewer.zmags.com + * WebCompat issue #21576 - https://webcompat.com/issues/21576 + * + * The zmags viewer locks out Firefox Mobile with a "Browser unsupported" + * message, but tests showed that it works just fine with a Chrome UA. + * Outreach attempts were unsuccessful, and as the site has a relatively + * high rank, we alter the UA. + */ + id: "bug1509873", + platform: "android", + domain: "zmags.com", + bug: "1509873", + config: { + matches: ["*://*.viewer.zmags.com/*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36" + ); + }, + }, + }, + { + /* + * Bug 1566253 - posts.google.com - Add UA override for posts.google.com + * WebCompat issue #17870 - https://webcompat.com/issues/17870 + * + * posts.google.com displaying "Your browser doesn't support this page". + * Spoofing as Chrome works fine. + */ + id: "bug1566253", + platform: "android", + domain: "posts.google.com", + bug: "1566253", + config: { + matches: ["*://posts.google.com/*"], + uaTransformer: _ => { + return "Mozilla/5.0 (Linux; Android 6.0.1; SM-G900M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.101 Mobile Safari/537.36"; + }, + }, + }, + { + /* + * Bug 1574522 - UA override for enuri.com on Firefox for Android + * WebCompat issue #37139 - https://webcompat.com/issues/37139 + * + * enuri.com returns a different template for Firefox on Android + * based on server side UA detection. This results in page content cut offs. + * Spoofing as Chrome fixes the issue + */ + id: "bug1574522", + platform: "android", + domain: "enuri.com", + bug: "1574522", + config: { + matches: ["*://enuri.com/*"], + uaTransformer: _ => { + return "Mozilla/5.0 (Linux; Android 6.0.1; SM-G900M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36"; + }, + }, + }, + { + /* + * Bug 1574564 - UA override for ceskatelevize.cz on Firefox for Android + * WebCompat issue #15467 - https://webcompat.com/issues/15467 + * + * ceskatelevize sets streamingProtocol depending on the User-Agent it sees + * in the request headers, returning DASH for Chrome, HLS for iOS, + * and Flash for Firefox Mobile. Since Mobile has no Flash, the video + * doesn't work. Spoofing as Chrome makes the video play + */ + id: "bug1574564", + platform: "android", + domain: "ceskatelevize.cz", + bug: "1574564", + config: { + matches: ["*://*.ceskatelevize.cz/*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36" + ); + }, + }, + }, + { + /* + * Bug 1577250 - UA override for homebook.pl on Firefox for Android + * WebCompat issue #24044 - https://webcompat.com/issues/24044 + * + * homebook.pl shows desktop site on Firefox for Android based on + * UA detection. Spoofing as Chrome allows to get mobile site. + */ + id: "bug1577250", + platform: "android", + domain: "homebook.pl", + bug: "1577250", + config: { + matches: ["*://*.homebook.pl/*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36" + ); + }, + }, + }, + { + /* + * Bug 1577267 - UA override for metfone.com.kh on Firefox for Android + * WebCompat issue #16363 - https://webcompat.com/issues/16363 + * + * metfone.com.kh has a server side UA detection which returns desktop site + * for Firefox for Android. Spoofing as Chrome allows to receive mobile version + */ + id: "bug1577267", + platform: "android", + domain: "metfone.com.kh", + bug: "1577267", + config: { + matches: ["*://*.metfone.com.kh/*"], + uaTransformer: originalUA => { + return ( + UAHelpers.getPrefix(originalUA) + + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36" + ); + }, + }, + }, + { + /* + * Bug 1598198 - User Agent extension for Samsung's galaxy.store URLs + * + * Samsung's galaxy.store shortlinks are supposed to redirect to a Samsung + * intent:// URL on Samsung devices, but to an error page on other brands. + * As we do not provide device info in our user agent string, this check + * fails, and even Samsung users land on an error page if they use Firefox + * for Android. + * This intervention adds a simple "Samsung" identifier to the User Agent + * on only the Galaxy Store URLs if the device happens to be a Samsung. + */ + id: "bug1598198", + platform: "android", + domain: "galaxy.store", + bug: "1598198", + config: { + matches: [ + "*://galaxy.store/*", + "*://dev.galaxy.store/*", + "*://stg.galaxy.store/*", + ], + uaTransformer: originalUA => { + if (!browser.systemManufacturer) { + return originalUA; + } + + const manufacturer = browser.systemManufacturer.getManufacturer(); + if (manufacturer && manufacturer.toLowerCase() === "samsung") { + return originalUA.replace("Mobile;", "Mobile; Samsung;"); + } + + return originalUA; + }, + }, + }, + { + /* + * Bug 1595215 - UA overrides for Uniqlo sites + * Webcompat issue #38825 - https://webcompat.com/issues/38825 + * + * To receive the proper mobile version instead of the desktop version or + * avoid redirect loop, the UA is spoofed. + */ + id: "bug1595215", + platform: "android", + domain: "uniqlo.com", + bug: "1595215", + config: { + matches: ["*://*.uniqlo.com/*"], + uaTransformer: originalUA => { + return originalUA + " Mobile Safari"; + }, + }, + }, + { + /* + * Bug 1621065 - UA overrides for bracketchallenge.ncaa.com + * Webcompat issue #49886 - https://webcompat.com/issues/49886 + * + * The NCAA bracket challenge website mistakenly classifies + * any non-Chrome browser on Android as "is_old_android". As a result, + * a modal is shown telling them they have security flaws. We have + * attempted to reach out for a fix (and clarification). + */ + id: "bug1621065", + platform: "android", + domain: "bracketchallenge.ncaa.com", + bug: "1621065", + config: { + matches: ["*://bracketchallenge.ncaa.com/*"], + uaTransformer: originalUA => { + return originalUA + " Chrome"; + }, + }, + }, + { + /* + * Bug 1622063 - UA override for wp1-ext.usps.gov + * Webcompat issue #29867 - https://webcompat.com/issues/29867 + * + * The Job Search site for USPS does not work for Firefox Mobile + * browsers (a 500 is returned). + */ + id: "bug1622063", + platform: "android", + domain: "wp1-ext.usps.gov", + bug: "1622063", + config: { + matches: ["*://wp1-ext.usps.gov/*"], + uaTransformer: originalUA => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1622081 - UA override for m2.bmo.com + * Webcompat issue #45019 - https://webcompat.com/issues/45019 + * + * Unless the UA string contains "Chrome", m2.bmo.com will + * display a modal saying the browser is out-of-date. + */ + id: "bug1622081", + platform: "android", + domain: "m2.bmo.com", + bug: "1622081", + config: { + matches: ["*://m2.bmo.com/*"], + uaTransformer: originalUA => { + return originalUA + " Chrome"; + }, + }, + }, + { + /* + * Bug 1628455 - UA override for autotrader.ca + * Webcompat issue #50961 - https://webcompat.com/issues/50961 + * + * autotrader.ca is showing desktop site for Firefox on Android + * based on server side UA detection. Spoofing as Chrome allows to + * get mobile experience + */ + id: "bug1628455", + platform: "android", + domain: "autotrader.ca", + bug: "1628455", + config: { + matches: ["https://*.autotrader.ca/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1630280 - UA override for dominos.ch + * Webcompat issue #48273 - https://webcompat.com/issues/48273 + * + * dominos.ch is suggesting downloading their native app and showing + * an overlay that can't be removed in Firefox for Android. Spoofing + * as Chrome allows to continue to the site + */ + id: "bug1630280", + platform: "android", + domain: "dominos.ch", + bug: "1630280", + config: { + matches: ["https://*.dominos.ch/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1563839 - rolb.santanderbank.com - Build UA override + * Bug 1646791 - bancosantander.es - Re-add UA override. + * Bug 1665129 - *.gruposantander.es - Add wildcard domains. + * WebCompat issue #33462 - https://webcompat.com/issues/33462 + * SuMo request - https://support.mozilla.org/es/questions/1291085 + * + * santanderbank expects UA to have 'like Gecko', otherwise it runs + * xmlDoc.onload whose support has been dropped. It results in missing labels in forms + * and some other issues. Adding 'like Gecko' fixes those issues. + */ + id: "bug1646791", + platform: "all", + domain: "santanderbank.com", + bug: "1646791", + config: { + matches: [ + "*://*.bancosantander.es/*", + "*://*.gruposantander.es/*", + "*://*.santander.co.uk/*", + "*://bob.santanderbank.com/*", + "*://rolb.santanderbank.com/*", + ], + uaTransformer: originalUA => { + return originalUA.replace("Gecko", "like Gecko"); + }, + }, + }, + { + /* + * Bug 1651292 - UA override for www.jp.square-enix.com + * Webcompat issue #53018 - https://webcompat.com/issues/53018 + * + * Unless the UA string contains "Chrome 66+", a section of + * www.jp.square-enix.com will show a never ending LOADING + * page. + */ + id: "bug1651292", + platform: "android", + domain: "www.jp.square-enix.com", + bug: "1651292", + config: { + matches: ["*://www.jp.square-enix.com/music/sem/page/FF7R/ost/*"], + uaTransformer: originalUA => { + return originalUA + " Chrome/83"; + }, + }, + }, + { + /* + * Bug 1654888 - UA override for ebuyer.com + * Webcompat issue #52463 - https://webcompat.com/issues/52463 + * + * This site returns desktop site based on server side UA detection. + * Spoofing as Chrome allows to get mobile experience + */ + id: "bug1654888", + platform: "android", + domain: "ebuyer.com", + bug: "1654888", + config: { + matches: ["*://*.ebuyer.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1666754 - Mobile UA override for lffl.org + * Bug 1665720 - lffl.org article page takes 2x as much time to load on Moto G + * + * This site returns desktop site based on server side UA detection. + * Spoofing as Chrome allows to get mobile experience + */ + id: "bug1666754", + platform: "android", + domain: "lffl.org", + bug: "1666754", + config: { + matches: ["*://*.lffl.org/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1679847 - Add UA override for avto.pro + * Webcompat issue #60043 - https://webcompat.com/issues/60043 + * + * Unless Chrome is in the UA, the site serves a desktop version + * on catalog pages + */ + id: "bug1679847", + platform: "android", + domain: "avto.pro", + bug: "1679847", + config: { + matches: ["https://avto.pro/catalog/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, + { + /* + * Bug 1679869 - Add UA override for vh1.com + * Webcompat issue #52755 - https://webcompat.com/issues/52755 + * + * The site is not showing videos on Firefox on mobile stating + * that android 4.4.4 and chrome browser required + */ + id: "bug1679869", + platform: "android", + domain: "vh1.com", + bug: "1679869", + config: { + matches: ["*://*.vh1.com/*"], + uaTransformer: () => { + return UAHelpers.getDeviceAppropriateChromeUA(); + }, + }, + }, +]; + +const UAHelpers = { + getDeviceAppropriateChromeUA() { + if (!UAHelpers._deviceAppropriateChromeUA) { + const userAgent = + typeof navigator !== "undefined" ? navigator.userAgent : ""; + const RunningFirefoxVersion = (userAgent.match(/Firefox\/([0-9.]+)/) || [ + "", + "58.0", + ])[1]; + const RunningAndroidVersion = + userAgent.match(/Android\/[0-9.]+/) || "Android 6.0"; + const ChromeVersionToMimic = "76.0.3809.111"; + const ChromePhoneUA = `Mozilla/5.0 (Linux; ${RunningAndroidVersion}; Nexus 5 Build/MRA58N) FxQuantum/${RunningFirefoxVersion} AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${ChromeVersionToMimic} Mobile Safari/537.36`; + const ChromeTabletUA = `Mozilla/5.0 (Linux; ${RunningAndroidVersion}; Nexus 7 Build/JSS15Q) FxQuantum/${RunningFirefoxVersion} AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${ChromeVersionToMimic} Safari/537.36`; + const IsPhone = userAgent.includes("Mobile"); + UAHelpers._deviceAppropriateChromeUA = IsPhone + ? ChromePhoneUA + : ChromeTabletUA; + } + return UAHelpers._deviceAppropriateChromeUA; + }, + getPrefix(originalUA) { + return originalUA.substr(0, originalUA.indexOf(")") + 1); + }, +}; + +module.exports = AVAILABLE_UA_OVERRIDES; |