Revision 9d825eaa
Added by koszko over 1 year ago
| background/webrequest.js | ||
|---|---|---|
| 50 | 50 |
#FROM common/misc.js IMPORT is_privileged_url, csp_header_regex |
| 51 | 51 |
#FROM common/policy.js IMPORT decide_policy |
| 52 | 52 |
|
| 53 |
#FROM background/patterns_query_manager.js IMPORT tree |
|
| 53 |
#FROM background/patterns_query_manager.js IMPORT tree, default_allow
|
|
| 54 | 54 |
|
| 55 | 55 |
let secret; |
| 56 | 56 |
|
| 57 |
let default_allow = false; |
|
| 58 |
|
|
| 59 |
async function track_default_allow() |
|
| 60 |
{
|
|
| 61 |
const set_val = ch => default_allow = (ch.new_val || {}).value;
|
|
| 62 |
const [tracking, settings] = await haketilodb.track.settings(set_val); |
|
| 63 |
for (const setting of settings) {
|
|
| 64 |
if (setting.name === "default_allow") |
|
| 65 |
default_allow = setting.value; |
|
| 66 |
} |
|
| 67 |
} |
|
| 68 |
|
|
| 69 | 57 |
function on_headers_received(details) |
| 70 | 58 |
{
|
| 71 | 59 |
const url = details.url; |
| ... | ... | |
| 74 | 62 |
|
| 75 | 63 |
let headers = details.responseHeaders; |
| 76 | 64 |
|
| 77 |
const policy = decide_policy(tree, details.url, !!default_allow, secret); |
|
| 65 |
const policy = |
|
| 66 |
decide_policy(tree, details.url, !!default_allow.value, secret); |
|
| 78 | 67 |
if (policy.allow) |
| 79 | 68 |
return; |
| 80 | 69 |
|
Also available in: Unified diff
add new root content script