Bug 1815733 - ESR 128 - Override navigator.clipboard.read() with a no-op for Outlook. a=dmeehan

Differential Revision: https://phabricator.services.mozilla.com/D217977
This commit is contained in:
Dennis Schubert 2024-07-31 22:30:54 +00:00
parent 944b2ccff6
commit 2010a777ba
7 changed files with 103 additions and 2 deletions

View file

@ -1072,6 +1072,28 @@ const AVAILABLE_INJECTIONS = [
],
},
},
{
id: "bug1815733",
platform: "desktop",
domain: "Office 365 Outlook locations",
bug: "1815733",
contentScripts: {
matches: [
"*://outlook.live.com/*",
"*://outlook.office.com/*",
"*://outlook.office365.com/*",
"*://outlook.office365.us/*",
"*://*.outlook.cn/*",
"*://*.outlook.com/*",
],
js: [
{
file: "injections/js/bug1815733-outlook365-clipboard-read-noop.js",
},
],
allFrames: true,
},
},
];
module.exports = AVAILABLE_INJECTIONS;

View file

@ -0,0 +1,28 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Bug 1815733 - Annoying "Paste" overlay when trying to paste
*
* As per https://bugzilla.mozilla.org/show_bug.cgi?id=1815733#c13, Outlook
* is calling clipboard.read() again when they shouldn't. This is causing a
* visible "Paste" prompt for the user, which is stealing focus and can be
* annoying.
*/
/* globals exportFunction */
Object.defineProperty(navigator.clipboard.wrappedJSObject, "read", {
value: exportFunction(function () {
return new Promise((resolve, _) => {
console.log(
"clipboard.read() has been overwriten with a no-op. See https://bugzilla.mozilla.org/show_bug.cgi?id=1815733#c13 for details."
);
resolve();
});
}, navigator.clipboard),
});

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
"version": "128.4.0",
"version": "128.5.0",
"browser_specific_settings": {
"gecko": {
"id": "webcompat@mozilla.org",

View file

@ -91,6 +91,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [
"injections/js/bug1774005-installtrigger-shim.js",
"injections/js/bug1799968-www.samsung.com-appVersion-linux-fix.js",
"injections/js/bug1799980-healow.com-infinite-loop-fix.js",
"injections/js/bug1815733-outlook365-clipboard-read-noop.js",
"injections/js/bug1818818-fastclick-legacy-shim.js",
"injections/js/bug1819450-cmbchina.com-ua-change.js",
"injections/js/bug1819476-axisbank.com-webkitSpeechRecognition-shim.js",

View file

@ -1072,6 +1072,28 @@ const AVAILABLE_INJECTIONS = [
],
},
},
{
id: "bug1815733",
platform: "desktop",
domain: "Office 365 Outlook locations",
bug: "1815733",
contentScripts: {
matches: [
"*://outlook.live.com/*",
"*://outlook.office.com/*",
"*://outlook.office365.com/*",
"*://outlook.office365.us/*",
"*://*.outlook.cn/*",
"*://*.outlook.com/*",
],
js: [
{
file: "injections/js/bug1815733-outlook365-clipboard-read-noop.js",
},
],
allFrames: true,
},
},
];
module.exports = AVAILABLE_INJECTIONS;

View file

@ -0,0 +1,28 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Bug 1815733 - Annoying "Paste" overlay when trying to paste
*
* As per https://bugzilla.mozilla.org/show_bug.cgi?id=1815733#c13, Outlook
* is calling clipboard.read() again when they shouldn't. This is causing a
* visible "Paste" prompt for the user, which is stealing focus and can be
* annoying.
*/
/* globals exportFunction */
Object.defineProperty(navigator.clipboard.wrappedJSObject, "read", {
value: exportFunction(function () {
return new Promise((resolve, _) => {
console.log(
"clipboard.read() has been overwriten with a no-op. See https://bugzilla.mozilla.org/show_bug.cgi?id=1815733#c13 for details."
);
resolve();
});
}, navigator.clipboard),
});

View file

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
"version": "128.4.0",
"version": "128.5.0",
"browser_specific_settings": {
"gecko": {
"id": "webcompat@mozilla.org",