bug1815733-outlook365-clipboard-read-noop.js (956B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 /** 8 * Bug 1815733 - Annoying "Paste" overlay when trying to paste 9 * 10 * As per https://bugzilla.mozilla.org/show_bug.cgi?id=1815733#c13, Outlook 11 * is calling clipboard.read() again when they shouldn't. This is causing a 12 * visible "Paste" prompt for the user, which is stealing focus and can be 13 * annoying. 14 */ 15 16 /* globals exportFunction */ 17 18 Object.defineProperty(navigator.clipboard.wrappedJSObject, "read", { 19 configurable: true, 20 value: exportFunction(function () { 21 return new Promise((resolve, _) => { 22 console.log( 23 "clipboard.read() has been overwriten with a no-op. See https://bugzilla.mozilla.org/show_bug.cgi?id=1815733#c13 for details." 24 ); 25 26 resolve(); 27 }); 28 }, navigator.clipboard), 29 });