1
0
Fork 0
firefox/browser/extensions/webcompat/injections/js/bug1815733-outlook365-clipboard-read-noop.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

29 lines
956 B
JavaScript

/* 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", {
configurable: true,
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),
});