author | Dennis Schubert <dschubert@mozilla.com> |
Fri, 14 Dec 2018 00:52:32 +0000 | |
changeset 450486 | f758b51496862ab70ec46c427328cf44503cf750 |
parent 450485 | 5dd777c5770d0a80575d6a6842725d3a1f048fc3 |
child 450487 | 836f752852c5c94caf33d5c4d7e9958c43e700f5 |
child 450517 | 5ead1d00b36e4da623c50555bd5aba88db9430f4 |
push id | 35202 |
push user | btara@mozilla.com |
push date | Fri, 14 Dec 2018 05:43:22 +0000 |
treeherder | mozilla-central@f758b5149686 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | kmag, rhelmer |
bugs | 1512907 |
milestone | 66.0a1 |
first release with | nightly linux32
f758b5149686
/
66.0a1
/
20181214054322
/
files
nightly linux64
f758b5149686
/
66.0a1
/
20181214054322
/
files
nightly mac
f758b5149686
/
66.0a1
/
20181214054322
/
files
nightly win32
f758b5149686
/
66.0a1
/
20181214054322
/
files
nightly win64
f758b5149686
/
66.0a1
/
20181214054322
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
66.0a1
/
20181214054322
/
pushlog to previous
nightly linux64
66.0a1
/
20181214054322
/
pushlog to previous
nightly mac
66.0a1
/
20181214054322
/
pushlog to previous
nightly win32
66.0a1
/
20181214054322
/
pushlog to previous
nightly win64
66.0a1
/
20181214054322
/
pushlog to previous
|
--- a/browser/extensions/webcompat/injections.js +++ b/browser/extensions/webcompat/injections.js @@ -15,17 +15,17 @@ const contentScripts = { ], desktop: [ { matches: ["https://ib.absa.co.za/*"], js: [{file: "injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js"}], runAt: "document_start", }, { - matches: ["http://histography.io/*"], + matches: ["*://histography.io/*"], js: [{file: "injections/js/bug1457335-histography.io-ua-change.js"}], runAt: "document_start", }, { matches: ["*://*.bankofamerica.com/*"], js: [{file: "injections/js/bug1472075-bankofamerica.com-ua-change.js"}], runAt: "document_start", },
--- a/browser/extensions/webcompat/ua_overrides.js +++ b/browser/extensions/webcompat/ua_overrides.js @@ -11,36 +11,48 @@ const UAOverrides = { * blocks all browsers but Chrome. * * This was only put in place to allow QA to test this system addon on an * actual site, since we were not able to find a proper override in time. */ { matches: ["*://webcompat-addon-testcases.schub.io/*"], uaTransformer: (originalUA) => { - let prefix = originalUA.substr(0, originalUA.indexOf(")") + 1); - return `${prefix} AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36`; + return UAHelpers.getPrefix(originalUA) + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36"; }, }, ], - desktop: [], + desktop: [ + /* + * Bug 1464106 - directvnow.com - Create a UA override for Directvnow.com for playback on desktop + * WebCompat issue #3846 - https://webcompat.com/issues/3846 + * + * directvnow.com is blocking Firefox via UA sniffing. Outreach is still going + * on, and playback works fine if we spoof as Chrome. + */ + { + matches: ["*://*.directvnow.com/*"], + uaTransformer: (originalUA) => { + return UAHelpers.getPrefix(originalUA) + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"; + }, + }, + ], android: [ /* * Bug 1480710 - m.imgur.com - Build UA override * WebCompat issue #13154 - https://webcompat.com/issues/13154 * * imgur returns a 404 for requests to CSS and JS file if requested with a Fennec * User Agent. By removing the Fennec identifies and adding Chrome Mobile's, we * receive the correct CSS and JS files. */ { matches: ["*://m.imgur.com/*"], uaTransformer: (originalUA) => { - let prefix = originalUA.substr(0, originalUA.indexOf(")") + 1); - return prefix + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.85 Mobile Safari/537.36"; + return UAHelpers.getPrefix(originalUA) + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.85 Mobile Safari/537.36"; }, }, /* * Bug 755590 - sites.google.com - top bar doesn't show up in Firefox for Android * * Google Sites does show a different top bar template based on the User Agent. * For Fennec, this results in a broken top bar. Appending Chrome and Mobile Safari @@ -62,21 +74,235 @@ const UAOverrides = { * to the User Agent gets us the same experience. */ { matches: ["*://tieba.baidu.com/*", "*://tiebac.baidu.com/*"], uaTransformer: (originalUA) => { return originalUA + " AppleWebKit/537.36 (KHTML, like Gecko)"; }, }, + + /* + * 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. + */ + { + matches: ["*://weather.yahoo.co.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. + */ + { + 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. + */ + { + matches: ["*://*.nhk.or.jp/*"], + uaTransformer: (originalUA) => { + return originalUA + " AppleWebKit"; + }, + }, + + /* + * 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. + */ + { + matches: ["*://*.uniqlo.com/*"], + uaTransformer: (originalUA) => { + return originalUA + " Mobile Safari"; + }, + }, + + /* + * Bug 1338260 - Add UA override for directTV + * (Imported from ua-update.json.in) + * + * DirectTV has issues with scrolling and cut-off images. Pretending to be + * Chrome for Android fixes those issues. + */ + { + matches: ["*://*.directv.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 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. + */ + { + matches: ["*://*.rakuten.co.jp/*"], + uaTransformer: (originalUA) => { + return originalUA.replace(/Firefox.+$/, ""); + }, + }, + + /* + * Bug 1483233 - Add a mobile UA override for ebay + * (Imported from ua-update.json.in) + * + * eBay's systems have an issue where Fennec gets sent into an endless + * redirect, rendering it completely unusable. + */ + { + matches: [ + "*://*.ebay.at/*", "*://*.ebay.be/*", "*://*.ebay.ca/*", "*://*.ebay.ch/*", + "*://*.ebay.cn/*", "*://*.ebay.co.th/*", "*://*.ebay.co.uk/*", "*://*.ebay.com.au/*", + "*://*.ebay.com.hk/*", "*://*.ebay.com.my/*", "*://*.ebay.com.sg/*", "*://*.ebay.com.tw/*", + "*://*.ebay.com/*", "*://*.ebay.de/*", "*://*.ebay.es/*", "*://*.ebay.fr/*", + "*://*.ebay.ie/*", "*://*.ebay.in/*", "*://*.ebay.it/*", "*://*.ebay.nl/*", + "*://*.ebay.ph/*", "*://*.ebay.pl/*", "*://*.ebay.vn/*", + ], + 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 969844 - mobile.de sends desktop site to Firefox on Android + * + * mobile.de sends the desktop site to Fennec. Spooing as Chrome works fine. + */ + { + 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 1476436 - mobile.bet365.com - add UA override for fennec + * WebCompat issue #17010 - https://webcompat.com/issues/17010 + * + * mobile.bet365.com serves fennec an alternative version with less interactive + * elements, although they work just fine. Spoofing as Chrome makes the + * interactive elements appear. + */ + { + matches: ["*://mobile.bet365.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 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. + */ + { + 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 1508564 - cnbc.com - Add UA override for videos on www.cnbc.com + * WebCompat issue #8410 - https://webcompat.com/issues/8410 + * + * The video framework loaded in via pdk.theplatform.com fails to + * acknowledge that Firefox does support HLS, so it fails to find a + * supported video format and shows the loading bar forever. Spoofing as + * Chrome works. + */ + { + matches: ["*://*.cnbc.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 1508516 - cineflix.com.br - Add UA override for cineflix.com.br/m/ + * WebCompat issue #21553 - https://webcompat.com/issues/21553 + * + * The site renders a blank page with any Firefox snipped in the UA as it + * is running into an exception. Spoofing as Chrome makes the site work + * fine. + */ + { + matches: ["*://*.cineflix.com.br/m/*"], + uaTransformer: (originalUA) => { + return UAHelpers.getPrefix(originalUA) + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36"; + }, + }, + + /* + * Bug 1509852 - redbull.com - Add UA override for redbull.com + * WebCompat issue #21439 - https://webcompat.com/issues/21439 + * + * Redbull.com blocks some features, for example the live video player, for + * Fennec. Spoofing as Chrome results in us rendering the video just fine, + * and everything else works as well. + */ + { + matches: ["*://*.redbull.com/*"], + uaTransformer: (originalUA) => { + return UAHelpers.getPrefix(originalUA) + " 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 Fennec 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. + */ + { + 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"; + }, + }, ], }; /* globals browser */ +const UAHelpers = { + getPrefix(originalUA) { + return originalUA.substr(0, originalUA.indexOf(")") + 1); + }, +}; + let activeListeners = []; function buildAndRegisterListener(matches, transformer) { let listener = (details) => { for (var header of details.requestHeaders) { if (header.name.toLowerCase() === "user-agent") { header.value = transformer(header.value); } }
--- a/mobile/android/extensions/webcompat/injections.js +++ b/mobile/android/extensions/webcompat/injections.js @@ -15,17 +15,17 @@ const contentScripts = { ], desktop: [ { matches: ["https://ib.absa.co.za/*"], js: [{file: "injections/js/bug1452707-window.controllers-shim-ib.absa.co.za.js"}], runAt: "document_start", }, { - matches: ["http://histography.io/*"], + matches: ["*://histography.io/*"], js: [{file: "injections/js/bug1457335-histography.io-ua-change.js"}], runAt: "document_start", }, { matches: ["*://*.bankofamerica.com/*"], js: [{file: "injections/js/bug1472075-bankofamerica.com-ua-change.js"}], runAt: "document_start", },
--- a/mobile/android/extensions/webcompat/ua_overrides.js +++ b/mobile/android/extensions/webcompat/ua_overrides.js @@ -11,36 +11,48 @@ const UAOverrides = { * blocks all browsers but Chrome. * * This was only put in place to allow QA to test this system addon on an * actual site, since we were not able to find a proper override in time. */ { matches: ["*://webcompat-addon-testcases.schub.io/*"], uaTransformer: (originalUA) => { - let prefix = originalUA.substr(0, originalUA.indexOf(")") + 1); - return `${prefix} AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36`; + return UAHelpers.getPrefix(originalUA) + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36"; }, }, ], - desktop: [], + desktop: [ + /* + * Bug 1464106 - directvnow.com - Create a UA override for Directvnow.com for playback on desktop + * WebCompat issue #3846 - https://webcompat.com/issues/3846 + * + * directvnow.com is blocking Firefox via UA sniffing. Outreach is still going + * on, and playback works fine if we spoof as Chrome. + */ + { + matches: ["*://*.directvnow.com/*"], + uaTransformer: (originalUA) => { + return UAHelpers.getPrefix(originalUA) + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"; + }, + }, + ], android: [ /* * Bug 1480710 - m.imgur.com - Build UA override * WebCompat issue #13154 - https://webcompat.com/issues/13154 * * imgur returns a 404 for requests to CSS and JS file if requested with a Fennec * User Agent. By removing the Fennec identifies and adding Chrome Mobile's, we * receive the correct CSS and JS files. */ { matches: ["*://m.imgur.com/*"], uaTransformer: (originalUA) => { - let prefix = originalUA.substr(0, originalUA.indexOf(")") + 1); - return prefix + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.85 Mobile Safari/537.36"; + return UAHelpers.getPrefix(originalUA) + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.85 Mobile Safari/537.36"; }, }, /* * Bug 755590 - sites.google.com - top bar doesn't show up in Firefox for Android * * Google Sites does show a different top bar template based on the User Agent. * For Fennec, this results in a broken top bar. Appending Chrome and Mobile Safari @@ -62,21 +74,235 @@ const UAOverrides = { * to the User Agent gets us the same experience. */ { matches: ["*://tieba.baidu.com/*", "*://tiebac.baidu.com/*"], uaTransformer: (originalUA) => { return originalUA + " AppleWebKit/537.36 (KHTML, like Gecko)"; }, }, + + /* + * 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. + */ + { + matches: ["*://weather.yahoo.co.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. + */ + { + 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. + */ + { + matches: ["*://*.nhk.or.jp/*"], + uaTransformer: (originalUA) => { + return originalUA + " AppleWebKit"; + }, + }, + + /* + * 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. + */ + { + matches: ["*://*.uniqlo.com/*"], + uaTransformer: (originalUA) => { + return originalUA + " Mobile Safari"; + }, + }, + + /* + * Bug 1338260 - Add UA override for directTV + * (Imported from ua-update.json.in) + * + * DirectTV has issues with scrolling and cut-off images. Pretending to be + * Chrome for Android fixes those issues. + */ + { + matches: ["*://*.directv.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 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. + */ + { + matches: ["*://*.rakuten.co.jp/*"], + uaTransformer: (originalUA) => { + return originalUA.replace(/Firefox.+$/, ""); + }, + }, + + /* + * Bug 1483233 - Add a mobile UA override for ebay + * (Imported from ua-update.json.in) + * + * eBay's systems have an issue where Fennec gets sent into an endless + * redirect, rendering it completely unusable. + */ + { + matches: [ + "*://*.ebay.at/*", "*://*.ebay.be/*", "*://*.ebay.ca/*", "*://*.ebay.ch/*", + "*://*.ebay.cn/*", "*://*.ebay.co.th/*", "*://*.ebay.co.uk/*", "*://*.ebay.com.au/*", + "*://*.ebay.com.hk/*", "*://*.ebay.com.my/*", "*://*.ebay.com.sg/*", "*://*.ebay.com.tw/*", + "*://*.ebay.com/*", "*://*.ebay.de/*", "*://*.ebay.es/*", "*://*.ebay.fr/*", + "*://*.ebay.ie/*", "*://*.ebay.in/*", "*://*.ebay.it/*", "*://*.ebay.nl/*", + "*://*.ebay.ph/*", "*://*.ebay.pl/*", "*://*.ebay.vn/*", + ], + 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 969844 - mobile.de sends desktop site to Firefox on Android + * + * mobile.de sends the desktop site to Fennec. Spooing as Chrome works fine. + */ + { + 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 1476436 - mobile.bet365.com - add UA override for fennec + * WebCompat issue #17010 - https://webcompat.com/issues/17010 + * + * mobile.bet365.com serves fennec an alternative version with less interactive + * elements, although they work just fine. Spoofing as Chrome makes the + * interactive elements appear. + */ + { + matches: ["*://mobile.bet365.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 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. + */ + { + 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 1508564 - cnbc.com - Add UA override for videos on www.cnbc.com + * WebCompat issue #8410 - https://webcompat.com/issues/8410 + * + * The video framework loaded in via pdk.theplatform.com fails to + * acknowledge that Firefox does support HLS, so it fails to find a + * supported video format and shows the loading bar forever. Spoofing as + * Chrome works. + */ + { + matches: ["*://*.cnbc.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 1508516 - cineflix.com.br - Add UA override for cineflix.com.br/m/ + * WebCompat issue #21553 - https://webcompat.com/issues/21553 + * + * The site renders a blank page with any Firefox snipped in the UA as it + * is running into an exception. Spoofing as Chrome makes the site work + * fine. + */ + { + matches: ["*://*.cineflix.com.br/m/*"], + uaTransformer: (originalUA) => { + return UAHelpers.getPrefix(originalUA) + " AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36"; + }, + }, + + /* + * Bug 1509852 - redbull.com - Add UA override for redbull.com + * WebCompat issue #21439 - https://webcompat.com/issues/21439 + * + * Redbull.com blocks some features, for example the live video player, for + * Fennec. Spoofing as Chrome results in us rendering the video just fine, + * and everything else works as well. + */ + { + matches: ["*://*.redbull.com/*"], + uaTransformer: (originalUA) => { + return UAHelpers.getPrefix(originalUA) + " 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 Fennec 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. + */ + { + 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"; + }, + }, ], }; /* globals browser */ +const UAHelpers = { + getPrefix(originalUA) { + return originalUA.substr(0, originalUA.indexOf(")") + 1); + }, +}; + let activeListeners = []; function buildAndRegisterListener(matches, transformer) { let listener = (details) => { for (var header of details.requestHeaders) { if (header.name.toLowerCase() === "user-agent") { header.value = transformer(header.value); } }