зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset d4b7aea9a014 (bug 1663967) for causing failures in browser_permmgr_sync.js CLOSED TREE
This commit is contained in:
Родитель
708c2f0ad2
Коммит
d830360f15
|
@ -151,6 +151,35 @@ const AVAILABLE_INJECTIONS = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "bug1567610",
|
||||||
|
platform: "all",
|
||||||
|
domain: "dns.google.com",
|
||||||
|
bug: "1567610",
|
||||||
|
contentScripts: {
|
||||||
|
matches: ["*://dns.google.com/*", "*://dns.google/*"],
|
||||||
|
css: [
|
||||||
|
{
|
||||||
|
file: "injections/css/bug1567610-dns.google.com-moz-fit-content.css",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "bug1568908",
|
||||||
|
platform: "desktop",
|
||||||
|
domain: "console.cloud.google.com",
|
||||||
|
bug: "1568908",
|
||||||
|
contentScripts: {
|
||||||
|
matches: ["*://*.console.cloud.google.com/*"],
|
||||||
|
css: [
|
||||||
|
{
|
||||||
|
file:
|
||||||
|
"injections/css/bug1568908-console.cloud.google.com-scrollbar-fix.css",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "bug1570119",
|
id: "bug1570119",
|
||||||
platform: "desktop",
|
platform: "desktop",
|
||||||
|
@ -231,6 +260,20 @@ const AVAILABLE_INJECTIONS = [
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: "bug1609991",
|
||||||
|
platform: "android",
|
||||||
|
domain: "www.cracked.com",
|
||||||
|
bug: "1609991",
|
||||||
|
contentScripts: {
|
||||||
|
matches: ["https://www.cracked.com/*"],
|
||||||
|
css: [
|
||||||
|
{
|
||||||
|
file: "injections/css/bug1609991-cracked.com-flex-basis-fix.css",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: "bug1610016",
|
id: "bug1610016",
|
||||||
platform: "android",
|
platform: "android",
|
||||||
|
@ -414,16 +457,16 @@ const AVAILABLE_INJECTIONS = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "bug1666771",
|
id: "bug1654906",
|
||||||
platform: "desktop",
|
platform: "all",
|
||||||
domain: "zillow.com",
|
domain: "reallygoodemails.com",
|
||||||
bug: "1666771",
|
bug: "1654906",
|
||||||
contentScripts: {
|
contentScripts: {
|
||||||
allFrames: true,
|
allFrames: true,
|
||||||
matches: ["*://*.zillow.com/*"],
|
matches: ["*://reallygoodemails.com/emails/*/live"],
|
||||||
css: [
|
js: [
|
||||||
{
|
{
|
||||||
file: "injections/css/bug1666771-zilow-map-overdraw.css",
|
file: "injections/js/bug1654906-contentDocument-fix.js",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -658,25 +658,6 @@ const AVAILABLE_UA_OVERRIDES = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
/*
|
|
||||||
* 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();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const UAHelpers = {
|
const UAHelpers = {
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/**
|
||||||
|
* dns.google.com - Page content is shifted to the left side of the page
|
||||||
|
* Bug #1567610 - https://bugzilla.mozilla.org/show_bug.cgi?id=1567610
|
||||||
|
* WebCompat issue #22494 - https://webcompat.com/issues/22494
|
||||||
|
*
|
||||||
|
* Affected element is styled with width:fit-content; which is not
|
||||||
|
* supported by Firefox yet, see https://bugzilla.mozilla.org/show_bug.cgi?id=1495868
|
||||||
|
* Adding -moz-fit-content fixes the issue
|
||||||
|
*/
|
||||||
|
main > .ng-star-inserted > .centered {
|
||||||
|
width: -moz-fit-content;
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
/**
|
||||||
|
* console.cloud.google.com - Double scrollbar visisible on long pages
|
||||||
|
* Bug #1568908 - https://bugzilla.mozilla.org/show_bug.cgi?id=1568908
|
||||||
|
* WebCompat issue #33164 - https://webcompat.com/issues/33164
|
||||||
|
*
|
||||||
|
* For pages that have contents heigher than the page's height, a secondary
|
||||||
|
* scrollbar outside the scrollable content area is visible. This is caused
|
||||||
|
* by a difference in Flexbox behavior, which is being addressed in
|
||||||
|
* https://bugs.chromium.org/p/chromium/issues/detail?id=981134
|
||||||
|
*
|
||||||
|
* Until this fix hits release and Google has updated their UI properly,
|
||||||
|
* this intervention addresses the differences.
|
||||||
|
*/
|
||||||
|
central-page-area {
|
||||||
|
min-height: 0;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
/**
|
||||||
|
* www.cracked.com - text and images don't reflow to fit screen width
|
||||||
|
* Bug #1609991 - https://bugzilla.mozilla.org/show_bug.cgi?id=1609991
|
||||||
|
* WebCompat issue #18218 - https://webcompat.com/issues/18218
|
||||||
|
*
|
||||||
|
* Text and images don't fit screen width due to
|
||||||
|
* https://bugzilla.mozilla.org/show_bug.cgi?id=1316534. Adding flex-basis: auto;
|
||||||
|
* to the affected element fixes the issue
|
||||||
|
*/
|
||||||
|
.col-12 {
|
||||||
|
flex-basis: auto;
|
||||||
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
/**
|
|
||||||
* zillow.com - Zillow using massive amounts of memory.
|
|
||||||
* Bug #1666771 - https://bugzilla.mozilla.org/show_bug.cgi?id=1666771
|
|
||||||
* Bug #1662297 - https://bugzilla.mozilla.org/show_bug.cgi?id=1662297
|
|
||||||
*
|
|
||||||
* Zillow's map is using a lot of memory, caused by large amounts of overdraw
|
|
||||||
* inside the map while rendering object boundaries. Setting `overflow: hidden`
|
|
||||||
* is a workaround until Zillow addressed this in a more permanent way.
|
|
||||||
*
|
|
||||||
* Note that this override is not without side effects: some lines in the map
|
|
||||||
* may/will be cut off. There is no side-effect free solution to this, and
|
|
||||||
* not intervening means the browser just freezes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
.zillow-map-layer svg.full-boundary-svg {
|
|
||||||
overflow: hidden !important;
|
|
||||||
}
|
|
|
@ -16,6 +16,10 @@
|
||||||
|
|
||||||
/* globals exportFunction */
|
/* globals exportFunction */
|
||||||
|
|
||||||
|
console.info(
|
||||||
|
"window.controllers has been shimmed for compatibility reasons. See https://webcompat.com/issues/16401 for details."
|
||||||
|
);
|
||||||
|
|
||||||
Object.defineProperty(window.wrappedJSObject, "controllers", {
|
Object.defineProperty(window.wrappedJSObject, "controllers", {
|
||||||
get: exportFunction(function() {
|
get: exportFunction(function() {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
/* globals exportFunction */
|
/* globals exportFunction */
|
||||||
|
|
||||||
|
console.info(
|
||||||
|
"The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/1804 for details."
|
||||||
|
);
|
||||||
|
|
||||||
const CHROME_UA = navigator.userAgent + " Chrome for WebCompat";
|
const CHROME_UA = navigator.userAgent + " Chrome for WebCompat";
|
||||||
|
|
||||||
Object.defineProperty(window.navigator.wrappedJSObject, "userAgent", {
|
Object.defineProperty(window.navigator.wrappedJSObject, "userAgent", {
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
/* globals exportFunction */
|
/* globals exportFunction */
|
||||||
|
|
||||||
if (!navigator.platform.includes("Win")) {
|
if (!navigator.platform.includes("Win")) {
|
||||||
|
console.info(
|
||||||
|
"The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/2787 for details."
|
||||||
|
);
|
||||||
|
|
||||||
const WINDOWS_UA = navigator.userAgent.replace(
|
const WINDOWS_UA = navigator.userAgent.replace(
|
||||||
/\(.*; rv:/i,
|
/\(.*; rv:/i,
|
||||||
"(Windows NT 10.0; Win64; x64; rv:"
|
"(Windows NT 10.0; Win64; x64; rv:"
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
/* globals exportFunction */
|
/* globals exportFunction */
|
||||||
|
|
||||||
|
console.info(
|
||||||
|
"window.GLOBALS.useragent.isTier1 has been set to true for compatibility reasons. See https://webcompat.com/issues/25844 for details."
|
||||||
|
);
|
||||||
|
|
||||||
let globals = {};
|
let globals = {};
|
||||||
|
|
||||||
Object.defineProperty(window.wrappedJSObject, "GLOBALS", {
|
Object.defineProperty(window.wrappedJSObject, "GLOBALS", {
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
/* globals exportFunction */
|
/* globals exportFunction */
|
||||||
|
|
||||||
|
console.info(
|
||||||
|
"window.PDFJS.disableWorker has been set to true for compatibility reasons. See https://webcompat.com/issues/39057 for details."
|
||||||
|
);
|
||||||
|
|
||||||
let globals = {};
|
let globals = {};
|
||||||
|
|
||||||
Object.defineProperty(window.wrappedJSObject, "PDFJS", {
|
Object.defineProperty(window.wrappedJSObject, "PDFJS", {
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
|
|
||||||
/* globals exportFunction */
|
/* globals exportFunction */
|
||||||
|
|
||||||
|
console.info(
|
||||||
|
"The user agent has been overridden for compatibility reasons. See https://webcompat.com/issues/40353 for details."
|
||||||
|
);
|
||||||
|
|
||||||
const APP_VERSION = navigator.appVersion + " mobile";
|
const APP_VERSION = navigator.appVersion + " mobile";
|
||||||
|
|
||||||
Object.defineProperty(window.navigator.wrappedJSObject, "appVersion", {
|
Object.defineProperty(window.navigator.wrappedJSObject, "appVersion", {
|
||||||
|
|
|
@ -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,
|
||||||
|
});
|
|
@ -1,24 +0,0 @@
|
||||||
/* 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 */
|
|
||||||
|
|
||||||
const ConsoleWarningEyeCatch = "Oh no!";
|
|
||||||
const ConsoleWarningDetails = `This web site has a web compatibility issue in Firefox. If you see this message and are responsible for working on $DOMAIN$, please investigate. More details about this issue and how to disable our workaround can be found on our about:compat page.`;
|
|
||||||
|
|
||||||
function promiseConsoleWarningScript(domain) {
|
|
||||||
const details = ConsoleWarningDetails.replace("$DOMAIN$", domain);
|
|
||||||
return Promise.resolve({
|
|
||||||
code: `if (!window.alreadyWarned) {
|
|
||||||
window.alreadyWarned = true;
|
|
||||||
console.warn("%c${ConsoleWarningEyeCatch}",
|
|
||||||
"font-size:50px; font-weight:bold; color:red; -webkit-text-stroke:1px black",
|
|
||||||
${JSON.stringify("\n" + details)});
|
|
||||||
}`,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = promiseConsoleWarningScript;
|
|
|
@ -4,34 +4,25 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/* globals browser, module, promiseConsoleWarningScript */
|
/* globals browser, module */
|
||||||
|
|
||||||
function getConsoleLogCallback(tabId) {
|
const replaceStringInRequest = (
|
||||||
return () => {
|
requestId,
|
||||||
// We don't actually know the site's we're hitting with these custom
|
inString,
|
||||||
// functions, so let's have the console say "this site".
|
outString,
|
||||||
promiseConsoleWarningScript("this site").then(script => {
|
inEncoding = "utf-8"
|
||||||
browser.tabs.executeScript(tabId, script).catch(() => {});
|
) => {
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const replaceStringInRequest = (requestId, inString, outString, callback) => {
|
|
||||||
const filter = browser.webRequest.filterResponseData(requestId);
|
const filter = browser.webRequest.filterResponseData(requestId);
|
||||||
const decoder = new TextDecoder("utf-8");
|
const decoder = new TextDecoder(inEncoding);
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
const RE = new RegExp(inString, "g");
|
const RE = new RegExp(inString, "g");
|
||||||
const carryoverLength = inString.length;
|
const carryoverLength = inString.length;
|
||||||
let carryover = "";
|
let carryover = "";
|
||||||
let doCallback = false;
|
|
||||||
|
|
||||||
filter.ondata = event => {
|
filter.ondata = event => {
|
||||||
const replaced = (
|
const replaced = (
|
||||||
carryover + decoder.decode(event.data, { stream: true })
|
carryover + decoder.decode(event.data, { stream: true })
|
||||||
).replace(RE, outString);
|
).replace(RE, outString);
|
||||||
if (callback && replaced.includes(outString)) {
|
|
||||||
doCallback = true;
|
|
||||||
}
|
|
||||||
filter.write(encoder.encode(replaced.slice(0, -carryoverLength)));
|
filter.write(encoder.encode(replaced.slice(0, -carryoverLength)));
|
||||||
carryover = replaced.slice(-carryoverLength);
|
carryover = replaced.slice(-carryoverLength);
|
||||||
};
|
};
|
||||||
|
@ -41,21 +32,17 @@ const replaceStringInRequest = (requestId, inString, outString, callback) => {
|
||||||
filter.write(encoder.encode(carryover));
|
filter.write(encoder.encode(carryover));
|
||||||
}
|
}
|
||||||
filter.close();
|
filter.close();
|
||||||
if (doCallback) {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const CUSTOM_FUNCTIONS = {
|
const CUSTOM_FUNCTIONS = {
|
||||||
detectSwipeFix: injection => {
|
detectSwipeFix: injection => {
|
||||||
const { urls, types } = injection.data;
|
const { urls, types } = injection.data;
|
||||||
const listener = (injection.data.listener = ({ requestId, tabId }) => {
|
const listener = (injection.data.listener = ({ requestId }) => {
|
||||||
replaceStringInRequest(
|
replaceStringInRequest(
|
||||||
requestId,
|
requestId,
|
||||||
"preventDefault:true",
|
"preventDefault:true",
|
||||||
"preventDefault:false",
|
"preventDefault:false"
|
||||||
getConsoleLogCallback(tabId)
|
|
||||||
);
|
);
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
@ -68,7 +55,6 @@ const CUSTOM_FUNCTIONS = {
|
||||||
browser.webRequest.onBeforeRequest.removeListener(listener);
|
browser.webRequest.onBeforeRequest.removeListener(listener);
|
||||||
delete injection.data.listener;
|
delete injection.data.listener;
|
||||||
},
|
},
|
||||||
|
|
||||||
noSniffFix: injection => {
|
noSniffFix: injection => {
|
||||||
const { urls, contentType } = injection.data;
|
const { urls, contentType } = injection.data;
|
||||||
const listener = (injection.data.listener = e => {
|
const listener = (injection.data.listener = e => {
|
||||||
|
@ -86,15 +72,13 @@ const CUSTOM_FUNCTIONS = {
|
||||||
browser.webRequest.onHeadersReceived.removeListener(listener);
|
browser.webRequest.onHeadersReceived.removeListener(listener);
|
||||||
delete injection.data.listener;
|
delete injection.data.listener;
|
||||||
},
|
},
|
||||||
|
|
||||||
pdk5fix: injection => {
|
pdk5fix: injection => {
|
||||||
const { urls, types } = injection.data;
|
const { urls, types } = injection.data;
|
||||||
const listener = (injection.data.listener = ({ requestId, tabId }) => {
|
const listener = (injection.data.listener = ({ requestId }) => {
|
||||||
replaceStringInRequest(
|
replaceStringInRequest(
|
||||||
requestId,
|
requestId,
|
||||||
"VideoContextChromeAndroid",
|
"VideoContextChromeAndroid",
|
||||||
"VideoContextAndroid",
|
"VideoContextAndroid"
|
||||||
getConsoleLogCallback(tabId)
|
|
||||||
);
|
);
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,11 +4,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/* globals browser, global, module, promiseConsoleWarningScript, require */
|
/* globals browser, module */
|
||||||
|
|
||||||
if (typeof promiseConsoleWarningScript === "undefined") {
|
|
||||||
global.promiseConsoleWarningScript = require("./console_warning_helper");
|
|
||||||
}
|
|
||||||
|
|
||||||
class Injections {
|
class Injections {
|
||||||
constructor(availableInjections, customFunctions) {
|
constructor(availableInjections, customFunctions) {
|
||||||
|
@ -82,18 +78,6 @@ class Injections {
|
||||||
return finalConfig;
|
return finalConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getContentScriptsIncludingConsoleWarning(injection) {
|
|
||||||
const finalScripts = Object.assign(
|
|
||||||
{},
|
|
||||||
this.assignContentScriptDefaults(injection.contentScripts)
|
|
||||||
);
|
|
||||||
if (!finalScripts.js) {
|
|
||||||
finalScripts.js = [];
|
|
||||||
}
|
|
||||||
finalScripts.js.push(await promiseConsoleWarningScript(injection.domain));
|
|
||||||
return finalScripts;
|
|
||||||
}
|
|
||||||
|
|
||||||
async enableInjection(injection) {
|
async enableInjection(injection) {
|
||||||
if (injection.active) {
|
if (injection.active) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -120,7 +104,7 @@ class Injections {
|
||||||
async enableContentScripts(injection) {
|
async enableContentScripts(injection) {
|
||||||
try {
|
try {
|
||||||
const handle = await browser.contentScripts.register(
|
const handle = await browser.contentScripts.register(
|
||||||
await this.getContentScriptsIncludingConsoleWarning(injection)
|
this.assignContentScriptDefaults(injection.contentScripts)
|
||||||
);
|
);
|
||||||
this._activeInjections.set(injection, handle);
|
this._activeInjections.set(injection, handle);
|
||||||
injection.active = true;
|
injection.active = true;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/* globals browser, module, promiseConsoleWarningScript */
|
/* globals browser, module */
|
||||||
|
|
||||||
class UAOverrides {
|
class UAOverrides {
|
||||||
constructor(availableOverrides) {
|
constructor(availableOverrides) {
|
||||||
|
@ -72,23 +72,10 @@ class UAOverrides {
|
||||||
) {
|
) {
|
||||||
for (const header of details.requestHeaders) {
|
for (const header of details.requestHeaders) {
|
||||||
if (header.name.toLowerCase() === "user-agent") {
|
if (header.name.toLowerCase() === "user-agent") {
|
||||||
// Don't override the UA if we're on a mobile device that has the
|
header.value = uaTransformer(header.value);
|
||||||
// "Request Desktop Site" mode enabled. The UA for the desktop mode
|
|
||||||
// is set inside Gecko with a simple string replace, so we can use
|
|
||||||
// that as a check, see https://searchfox.org/mozilla-central/rev/89d33e1c3b0a57a9377b4815c2f4b58d933b7c32/mobile/android/chrome/geckoview/GeckoViewSettingsChild.js#23-28
|
|
||||||
let isMobileWithDesktopMode =
|
|
||||||
override.currentPlatform == "android" &&
|
|
||||||
header.value.includes("X11; Linux x86_64");
|
|
||||||
|
|
||||||
if (!isMobileWithDesktopMode) {
|
|
||||||
header.value = uaTransformer(header.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
promiseConsoleWarningScript(override.domain).then(script => {
|
|
||||||
browser.tabs.executeScript(details.tabId, script).catch(() => {});
|
|
||||||
});
|
|
||||||
return { requestHeaders: details.requestHeaders };
|
return { requestHeaders: details.requestHeaders };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -190,7 +177,6 @@ class UAOverrides {
|
||||||
for (const override of this._availableOverrides) {
|
for (const override of this._availableOverrides) {
|
||||||
if (platformMatches.includes(override.platform)) {
|
if (platformMatches.includes(override.platform)) {
|
||||||
override.availableOnPlatform = true;
|
override.availableOnPlatform = true;
|
||||||
override.currentPlatform = platformInfo.os;
|
|
||||||
|
|
||||||
// Note whether the user is actively in the override's experiment (if any).
|
// Note whether the user is actively in the override's experiment (if any).
|
||||||
override.experimentActive = false;
|
override.experimentActive = false;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Web Compatibility Interventions",
|
"name": "Web Compat",
|
||||||
"description": "Urgent post-release fixes for web compatibility.",
|
"description": "Urgent post-release fixes for web compatibility.",
|
||||||
"version": "16.0.0",
|
"version": "15.1.0",
|
||||||
|
|
||||||
"applications": {
|
"applications": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
|
@ -114,7 +114,6 @@
|
||||||
"data/shims.js",
|
"data/shims.js",
|
||||||
"data/ua_overrides.js",
|
"data/ua_overrides.js",
|
||||||
"lib/about_compat_broker.js",
|
"lib/about_compat_broker.js",
|
||||||
"lib/console_warning_helper.js",
|
|
||||||
"lib/custom_functions.js",
|
"lib/custom_functions.js",
|
||||||
"lib/injections.js",
|
"lib/injections.js",
|
||||||
"lib/picture_in_picture_overrides.js",
|
"lib/picture_in_picture_overrides.js",
|
||||||
|
|
|
@ -51,11 +51,14 @@ FINAL_TARGET_FILES.features['webcompat@mozilla.org']['experiment-apis'] += [
|
||||||
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['css'] += [
|
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['css'] += [
|
||||||
'injections/css/bug0000000-testbed-css-injection.css',
|
'injections/css/bug0000000-testbed-css-injection.css',
|
||||||
'injections/css/bug1561371-mail.google.com-allow-horizontal-scrolling.css',
|
'injections/css/bug1561371-mail.google.com-allow-horizontal-scrolling.css',
|
||||||
|
'injections/css/bug1567610-dns.google.com-moz-fit-content.css',
|
||||||
|
'injections/css/bug1568908-console.cloud.google.com-scrollbar-fix.css',
|
||||||
'injections/css/bug1570119-teamcoco.com-scrollbar-width.css',
|
'injections/css/bug1570119-teamcoco.com-scrollbar-width.css',
|
||||||
'injections/css/bug1570328-developer-apple.com-transform-scale.css',
|
'injections/css/bug1570328-developer-apple.com-transform-scale.css',
|
||||||
'injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.css',
|
'injections/css/bug1575000-apply.lloydsbank.co.uk-radio-buttons-fix.css',
|
||||||
'injections/css/bug1577297-kitkat.com.au-slider-width-fix.css',
|
'injections/css/bug1577297-kitkat.com.au-slider-width-fix.css',
|
||||||
'injections/css/bug1605611-maps.google.com-directions-time.css',
|
'injections/css/bug1605611-maps.google.com-directions-time.css',
|
||||||
|
'injections/css/bug1609991-cracked.com-flex-basis-fix.css',
|
||||||
'injections/css/bug1610016-gaana.com-input-position-fix.css',
|
'injections/css/bug1610016-gaana.com-input-position-fix.css',
|
||||||
'injections/css/bug1610344-directv.com.co-hide-unsupported-message.css',
|
'injections/css/bug1610344-directv.com.co-hide-unsupported-message.css',
|
||||||
'injections/css/bug1632019-everyman.co-gallery-width-fix.css',
|
'injections/css/bug1632019-everyman.co-gallery-width-fix.css',
|
||||||
|
@ -67,7 +70,6 @@ FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['css'] += [
|
||||||
'injections/css/bug1654877-preev.com-moz-appearance-fix.css',
|
'injections/css/bug1654877-preev.com-moz-appearance-fix.css',
|
||||||
'injections/css/bug1654907-reactine.ca-hide-unsupported.css',
|
'injections/css/bug1654907-reactine.ca-hide-unsupported.css',
|
||||||
'injections/css/bug1655049-dev.to-unclickable-button-fix.css',
|
'injections/css/bug1655049-dev.to-unclickable-button-fix.css',
|
||||||
'injections/css/bug1666771-zilow-map-overdraw.css',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['js'] += [
|
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['js'] += [
|
||||||
|
@ -79,6 +81,7 @@ FINAL_TARGET_FILES.features['webcompat@mozilla.org']['injections']['js'] += [
|
||||||
'injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js',
|
'injections/js/bug1579159-m.tailieu.vn-pdfjs-worker-disable.js',
|
||||||
'injections/js/bug1605611-maps.google.com-directions-time.js',
|
'injections/js/bug1605611-maps.google.com-directions-time.js',
|
||||||
'injections/js/bug1610358-pcloud.com-appVersion-change.js',
|
'injections/js/bug1610358-pcloud.com-appVersion-change.js',
|
||||||
|
'injections/js/bug1654906-contentDocument-fix.js',
|
||||||
]
|
]
|
||||||
|
|
||||||
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['shims'] += [
|
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['shims'] += [
|
||||||
|
@ -102,7 +105,6 @@ FINAL_TARGET_FILES.features['webcompat@mozilla.org']['shims'] += [
|
||||||
|
|
||||||
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['lib'] += [
|
FINAL_TARGET_FILES.features['webcompat@mozilla.org']['lib'] += [
|
||||||
'lib/about_compat_broker.js',
|
'lib/about_compat_broker.js',
|
||||||
'lib/console_warning_helper.js',
|
|
||||||
'lib/custom_functions.js',
|
'lib/custom_functions.js',
|
||||||
'lib/injections.js',
|
'lib/injections.js',
|
||||||
'lib/intervention_helpers.js',
|
'lib/intervention_helpers.js',
|
||||||
|
|
Загрузка…
Ссылка в новой задаче