aboutsummaryrefslogtreecommitdiff
path: root/main_background.js
diff options
context:
space:
mode:
authorhackademix <giorgio@maone.net>2018-08-06 22:57:13 +0200
committerhackademix <giorgio@maone.net>2018-08-06 22:57:13 +0200
commit3f2aca651b85d73c8a217bda927c36bf7e6b43f8 (patch)
tree7b19a34078217afcc688e99614b4fa2ce3d1d77f /main_background.js
parent2cb91e36eed08993c0a9ca693f910b153705da65 (diff)
Fixed report attempts when no tabId is available.
Diffstat (limited to 'main_background.js')
-rw-r--r--main_background.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/main_background.js b/main_background.js
index c409959..d401b96 100644
--- a/main_background.js
+++ b/main_background.js
@@ -758,14 +758,17 @@ async function get_script(response, url, tabId = -1, whitelisted = false, index
let scriptName = url.split("/").pop();
if (whitelisted) {
- let site = ListStore.siteItem(url);
- // Accept without reading script, it was explicitly whitelisted
- let reason = whitelist.contains(site)
- ? `All ${site} whitelisted by user`
- : "Address whitelisted by user";
+ if (tabId !== -1) {
+ let site = ListStore.siteItem(url);
+ // Accept without reading script, it was explicitly whitelisted
+ let reason = whitelist.contains(site)
+ ? `All ${site} whitelisted by user`
+ : "Address whitelisted by user";
addReportEntry(tabId, url, {"whitelisted": [url, reason], url});
+ }
return result(`/* LibreJS: script whitelisted by user preference. */\n${response}`);
}
+
let [verdict, editedSource, reason] = license_read(response, scriptName, index === -2);
if (tabId < 0) {
@@ -888,6 +891,7 @@ var ResponseHandler = {
*/
async post(response) {
let {url, type} = response.request;
+ url = ListStore.urlItem(url);
let handle_it = type === "script" ? handle_script : handle_html;
return await handle_it(response, response.whitelisted);
}