summaryrefslogtreecommitdiff
path: root/background
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-14 18:49:55 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-14 18:49:55 +0100
commitcf838016b70bc55d8fb19a10b4deb580289e3769 (patch)
tree8c6e8f271e38f8cf7edd7ae733b68ac70c2b7076 /background
parent1869062a9d6ae736bdfe5e2993dfe1f280af4d8b (diff)
downloadbrowser-extension-cf838016b70bc55d8fb19a10b4deb580289e3769.tar.gz
browser-extension-cf838016b70bc55d8fb19a10b4deb580289e3769.zip
restore chromium support
Diffstat (limited to 'background')
-rw-r--r--background/patterns_query_manager.js6
-rw-r--r--background/webrequest.js7
2 files changed, 6 insertions, 7 deletions
diff --git a/background/patterns_query_manager.js b/background/patterns_query_manager.js
index 3e2953f..d3c659a 100644
--- a/background/patterns_query_manager.js
+++ b/background/patterns_query_manager.js
@@ -4,7 +4,7 @@
* Function: Instantiate the Pattern Tree data structure, filled with mappings
* from IndexedDB.
*
- * Copyright (C) 2021,2022 Wojtek Kosior
+ * Copyright (C) 2021, 2022 Wojtek Kosior
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -110,10 +110,8 @@ function register(kind, object) {
pqt.register(tree, object.pattern, "~allow", object.allow + 0);
}
-#IF MOZILLA || MV3
const id = kind === "mappings" ? object.identifier : object.pattern;
currently_registered.set(id, object);
-#ENDIF
}
function changed(kind, change) {
@@ -126,9 +124,7 @@ function changed(kind, change) {
pqt.deregister(tree, change.key, "~allow");
}
-#IF MOZILLA || MV3
currently_registered.delete(change.key);
-#ENDIF
}
if (change.new_val !== undefined)
diff --git a/background/webrequest.js b/background/webrequest.js
index cb89a3d..bceba26 100644
--- a/background/webrequest.js
+++ b/background/webrequest.js
@@ -113,6 +113,9 @@ function on_before_request(details)
if (details.type !== "xmlhttprequest")
return {cancel: true};
+ if (details.url.startsWith(redirect_url_template))
+ return;
+
#IF DEBUG
console.debug(`Settings queried using XHR for '${details.url}'.`);
#ENDIF
@@ -130,14 +133,14 @@ function on_before_request(details)
return {cancel: true};
}
- const policy = decide_policy(tree, details.url, default_allow, secret);
+ const policy = decide_policy(tree, queried_url, default_allow, secret);
if (!policy.error) {
const encoded_policy = encodeURIComponent(JSON.stringify(policy));
return {redirectUrl: redirect_url_template + encoded_policy};
}
}
- console.warn(`Bad request! Expected ${browser.runtime.getURL("dummy")}?url=<valid_urlencoded_url>. Got ${request_url}. This might be the result of page fingerprinting the browser.`);
+ console.warn(`Bad request! Expected ${browser.runtime.getURL("dummy")}?url=<valid_urlencoded_url>. Got ${details.url}. This might be the result of page fingerprinting the browser.`);
return {cancel: true};
}