Bug 1687944 - log a message to the web console when users opt in to allowing trackers via shims; r=denschub,webcompat-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D103085
This commit is contained in:
Thomas Wisniewski 2021-01-26 19:49:27 +00:00
Родитель b2599f4aae
Коммит 3f8e34cb34
2 изменённых файлов: 20 добавлений и 3 удалений

Просмотреть файл

@ -270,7 +270,7 @@ class Shims {
}
async _onMessageFromShim(payload, sender, sendResponse) {
const { tab } = sender;
const { tab, frameId } = sender;
const { id, url } = tab;
const { shimId, message } = payload;
@ -297,7 +297,24 @@ class Shims {
} else if (message === "optIn") {
try {
await shim.onUserOptIn(new URL(url).hostname);
warn("** User opted in on tab ", id, "for", shimId);
const { name, bug } = shim;
const origin = new URL(tab.url).origin;
warn(
"** User opted in for",
name,
"shim on",
origin,
"on tab",
id,
"frame",
frameId
);
const warning = `${name} is now being allowed on ${origin} for this browsing session. See https://bugzilla.mozilla.org/show_bug.cgi?id=${bug} for details.`;
await browser.tabs.executeScript(id, {
code: `console.warn(${JSON.stringify(warning)})`,
frameId,
runAt: "document_start",
});
} catch (err) {
console.error(err);
throw new Error("error");

Просмотреть файл

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Web Compatibility Interventions",
"description": "Urgent post-release fixes for web compatibility.",
"version": "19.0.0",
"version": "19.1.0",
"applications": {
"gecko": {