Bug 1649244 - Import v15.0.0 webcompat addon sources. r=miketaylr,webcompat-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D90113
This commit is contained in:
Thomas Wisniewski 2020-09-14 16:54:02 +00:00
Родитель 71ab95351c
Коммит a403006cb0
8 изменённых файлов: 123 добавлений и 13 удалений

Просмотреть файл

@ -456,6 +456,21 @@ const AVAILABLE_INJECTIONS = [
],
},
},
{
id: "bug1654906",
platform: "all",
domain: "reallygoodemails.com",
bug: "1654906",
contentScripts: {
allFrames: true,
matches: ["*://reallygoodemails.com/emails/*/live"],
js: [
{
file: "injections/js/bug1654906-contentDocument-fix.js",
},
],
},
},
];
module.exports = AVAILABLE_INJECTIONS;

Просмотреть файл

@ -40,6 +40,7 @@ let AVAILABLE_PIP_OVERRIDES;
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: {

Просмотреть файл

@ -233,7 +233,8 @@ const AVAILABLE_UA_OVERRIDES = [
/*
* Bug 969844 - mobile.de sends desktop site to Firefox on Android
*
* mobile.de sends the desktop site to Fennec. Spooing as Chrome works fine.
* mobile.de sends the desktop site to Firefox Mobile.
* Spoofing as Chrome works fine.
*/
id: "bug969844",
platform: "android",
@ -271,10 +272,10 @@ const AVAILABLE_UA_OVERRIDES = [
* 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.
* 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",
@ -336,8 +337,8 @@ const AVAILABLE_UA_OVERRIDES = [
*
* ceskatelevize sets streamingProtocol depending on the User-Agent it sees
* in the request headers, returning DASH for Chrome, HLS for iOS,
* and Flash for Fennec. Since Fennec has no Flash, the video doesn't work.
* Spoofing as Chrome makes the video play
* 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",
@ -636,6 +637,25 @@ const AVAILABLE_UA_OVERRIDES = [
},
},
},
{
/*
* Bug 1664174 - UA override for indiatimes.com
* Webcompat issue #57961 - https://webcompat.com/issues/57961
*
* This site returns desktop site based on server side UA detection.
* Spoofing as Chrome allows to get mobile experience
*/
id: "bug1664174",
platform: "android",
domain: "indiatimes.com",
bug: "1664174",
config: {
matches: ["*://*.indiatimes.com/*"],
uaTransformer: () => {
return UAHelpers.getDeviceAppropriateChromeUA();
},
},
},
];
const UAHelpers = {

Просмотреть файл

@ -38,8 +38,13 @@ class Manager {
const channel = subject.QueryInterface(
Ci.nsIUrlClassifierBlockedChannel
);
const { channelId, topLevelUrl, url } = channel;
const topHost = new URL(topLevelUrl).hostname;
const { channelId, url } = channel;
let topHost;
try {
topHost = new URL(channel.topLevelUrl).hostname;
} catch (_) {
return;
}
for (const allowList of this._allowLists.values()) {
for (const entry of allowList.values()) {
const { matcher, hosts, notHosts } = entry;

Просмотреть файл

@ -1,11 +1,11 @@
/**
* mail.google.com - The HTML email view does not allow horizontal scrolling
* on Fennec due to a missing CSS rule which is only served to Chrome.
* on Firefox mobile due to a missing CSS rule which is only served to Chrome.
* Bug #1561371 - https://bugzilla.mozilla.org/show_bug.cgi?id=1561371
*
* HTML emails may sometimes contain content that does not wrap, yet the
* CSS served to Fennec does not permit scrolling horizontally. To prevent
* this UX frustration, we enable horizontal scrolling.
* CSS served to Firefox Mobile does not permit scrolling horizontally.
* To prevent this UX frustration, we enable horizontal scrolling.
*/
body > #views {
overflow: auto;

Просмотреть файл

@ -0,0 +1,68 @@
"use strict";
/**
* Bug 1654906 - Build site patch for reallygoodemails.com
* WebCompat issue #16401 - https://webcompat.com/issues/55001
*
* The live email preview at reallygoodemails.com presumes that iframes
* will never be in an uninitialized readyState, and so ends up setting
* their innerHTML before they are ready. This intervention detects when
* they call innerHTML for an uninitialized contentDocument on an iframe,
* and waits for it to actually load before setting the innerHTML.
*/
/* globals exportFunction */
console.info(
"iframe.contentDocument has been shimmed for compatibility reasons. See https://webcompat.com/issues/55001 for details."
);
var elemProto = window.wrappedJSObject.Element.prototype;
var innerHTML = Object.getOwnPropertyDescriptor(elemProto, "innerHTML");
var iFrameProto = window.wrappedJSObject.HTMLIFrameElement.prototype;
var oldIFrameContentDocumentProp = Object.getOwnPropertyDescriptor(
iFrameProto,
"contentDocument"
);
var uninitializedContentDocs = new Set();
Object.defineProperty(iFrameProto, "contentDocument", {
get: exportFunction(function() {
const frame = this;
const contentDoc = oldIFrameContentDocumentProp.get.call(frame);
let latestHTMLToSet; // in case innerHTML is set multiple times before load
let waitingForLoad = false;
if (contentDoc.readyState === "uninitialized") {
if (!uninitializedContentDocs.has(contentDoc)) {
uninitializedContentDocs.add(contentDoc);
Object.defineProperty(contentDoc.documentElement, "innerHTML", {
get: innerHTML.get,
set: exportFunction(function(html) {
latestHTMLToSet = html;
if (waitingForLoad) {
return;
}
if (contentDoc.readyState !== "uninitialized") {
innerHTML.set.call(this, latestHTMLToSet);
return;
}
waitingForLoad = true;
frame.addEventListener(
"load",
() => {
uninitializedContentDocs.delete(contentDoc);
const { documentElement } = frame.contentDocument;
innerHTML.set.call(documentElement, latestHTMLToSet);
waitingForLoad = false;
},
{ once: true }
);
}, window),
});
}
}
return contentDoc;
}, window),
set: oldIFrameContentDocumentProp.set,
});

Просмотреть файл

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compat",
"description": "Urgent post-release fixes for web compatibility.",
"version": "14.2.0",
"version": "15.0.0",
"applications": {
"gecko": {

Просмотреть файл

@ -81,6 +81,7 @@ FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['js'] += [
'injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js',
'injections/js/bug1605611-maps.google.com-directions-time.js',
'injections/js/bug1610358-pcloud.com-appVersion-change.js',
'injections/js/bug1654906-contentDocument-fix.js',
]
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['shims'] += [