Bug 1731825 - Hide the Office365 Outlook registerProtocolHandler notification after it shows once, as a work-around until bug 668577 is fixed; r=ksenia,webcompat-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D126374
This commit is contained in:
Thomas Wisniewski
2021-09-23 15:01:27 +00:00
parent 55f385353e
commit 0b84b69e40
4 changed files with 54 additions and 1 deletions

View File

@@ -375,6 +375,26 @@ const AVAILABLE_INJECTIONS = [
],
},
},
{
id: "bug1731825",
platform: "desktop",
domain: "Office 365 email handling prompt",
bug: "1731825",
contentScripts: {
matches: [
"*://*.live.com/*",
"*://*.office.com/*",
"*://*.sharepoint.com/*",
],
js: [
{
file:
"injections/js/bug1731825-office365-email-handling-prompt-autohide.js",
},
],
allFrames: true,
},
},
{
id: "bug1707795",
platform: "desktop",

View File

@@ -0,0 +1,32 @@
"use strict";
/**
* Bug 1731825 - Office 365 email handling prompt autohide
*
* This site patch prevents the notification bar on Office 365
* apps from popping up on each page-load, offering to handle
* email with Outlook.
*/
/* globals exportFunction */
const warning =
"Office 365 Outlook email handling prompt has been hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=1731825 for details.";
const localStorageKey = "mailProtocolHandlerAlreadyOffered";
const nav = navigator.wrappedJSObject;
const { registerProtocolHandler } = nav;
const { localStorage } = window.wrappedJSObject;
Object.defineProperty(navigator.wrappedJSObject, "registerProtocolHandler", {
value: exportFunction(function(scheme, url, title) {
if (localStorage.getItem(localStorageKey)) {
console.info(warning);
return undefined;
}
registerProtocolHandler.call(nav, scheme, url, title);
localStorage.setItem(localStorageKey, true);
return undefined;
}, window),
});

View File

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

View File

@@ -78,6 +78,7 @@ FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["injections"]["js"] += [
"injections/js/bug1714612-www.rfi.it-outertext.js",
"injections/js/bug1724764-amextravel.com-window-print.js",
"injections/js/bug1724868-news.yahoo.co.jp-ua-override.js",
"injections/js/bug1731825-office365-email-handling-prompt-autohide.js",
]
FINAL_TARGET_FILES.features["webcompat@mozilla.org"]["shims"] += [