From 8f71c8f4d35f3af21b59439e7afb6ebf3b6ea8e8 Mon Sep 17 00:00:00 2001 From: hackademix Date: Sun, 21 Jul 2019 10:55:59 +0200 Subject: Add "Collapse blocked objects" option to the Blocked Objects prompt. --- src/bg/RequestGuard.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/bg') diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js index bdf2ea2..a3631c8 100644 --- a/src/bg/RequestGuard.js +++ b/src/bg/RequestGuard.js @@ -173,7 +173,7 @@ var RequestGuard = (() => { TabStatus.recordAll(sender.tab.id, message.seen); return true; }, - async enable(message, sender) { + async blockedObjects(message, sender) { let {url, documentUrl, policyType} = message; let TAG = `<${policyType.toUpperCase()}>`; let origin = Sites.origin(url); @@ -184,7 +184,8 @@ var RequestGuard = (() => { } options = [ {label: _("allowLocal", siteKey), checked: true}, - {label: _("allowLocal", origin)} + {label: _("allowLocal", origin)}, + {label: _("CollapseBlockedObjects")}, ]; let t = u => `${TAG}@${u}`; let ret = await Prompts.prompt({ @@ -193,6 +194,9 @@ var RequestGuard = (() => { options}); debug(`Prompt returned %o`); if (ret.button !== 0) return; + if (ret.option === 2) { + return {collapse: "all"}; + } let key = [siteKey, origin][ret.option || 0]; if (!key) return; let {siteMatch, contextMatch, perms} = ns.policy.get(key, documentUrl); @@ -210,7 +214,7 @@ var RequestGuard = (() => { ns.policy.set(key, perms); await ns.savePolicy(); } - return true; + return {enable: key}; }, } const Content = { -- cgit v1.2.3