diff options
Diffstat (limited to 'src/bg')
-rw-r--r-- | src/bg/RequestGuard.js | 16 | ||||
-rw-r--r-- | src/bg/main.js | 9 |
2 files changed, 9 insertions, 16 deletions
diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js index ccf3c70..e6be19e 100644 --- a/src/bg/RequestGuard.js +++ b/src/bg/RequestGuard.js @@ -263,7 +263,7 @@ var RequestGuard = (() => { return true; }, - async docStatus(message, sender) { + async queryDocStatus(message, sender) { let {frameId, tab} = sender; let {url} = message; let tabId = tab.id; @@ -291,10 +291,9 @@ var RequestGuard = (() => { if (pending) request.initialUrl = pending.initialUrl; if (type !== "sub_frame") { // we couldn't deliver it to frameId, since it's generally not loaded yet try { - await browser.tabs.sendMessage( - tabId, - {type: "seen", request, allowed, policyType, ownFrame: true}, - {frameId} + await Messages.send("seen", + {request, allowed, policyType, ownFrame: true}, + {tabId, frameId} ); } catch (e) { debug(`Couldn't deliver "seen" message for ${type}@${url} ${allowed ? "A" : "F" } to document ${documentUrl} (${frameId}/${tabId})`, e); @@ -302,10 +301,9 @@ var RequestGuard = (() => { } if (frameId === 0) return; try { - await browser.tabs.sendMessage( - tabId, - {type: "seen", request, allowed, policyType}, - {frameId: 0} + await Message.send("seen", + {request, allowed, policyType}, + {tabId, frameId: 0} ); } catch (e) { debug(`Couldn't deliver "seen" message to top frame containing ${documentUrl} (${frameId}/${tabId}`, e); diff --git a/src/bg/main.js b/src/bg/main.js index 3882191..47d28a3 100644 --- a/src/bg/main.js +++ b/src/bg/main.js @@ -118,8 +118,7 @@ let policy = ns.policy.dry(true); let seen = tabId !== -1 ? await ns.collectSeen(tabId) : null; let xssUserChoices = await XSS.getUserChoices(); - browser.runtime.sendMessage({ - type: "settings", + await Messages.send("settings", { policy, seen, xssUserChoices, @@ -228,11 +227,7 @@ async collectSeen(tabId) { try { - let seen = Array.from(await browser.tabs.sendMessage(tabId, { - type: "collect" - }, { - frameId: 0 - })); + let seen = Array.from(await Messages.send("collect", {}, {tabId, frameId: 0})); debug("Collected seen", seen); return seen; } catch (e) { |