Revision 6247f163
Added by koszko about 2 years ago
| background/main.js | ||
|---|---|---|
| 9 | 9 |
* IMPORTS_START |
| 10 | 10 |
* IMPORT TYPE_PREFIX |
| 11 | 11 |
* IMPORT get_storage |
| 12 |
* IMPORT light_storage |
|
| 12 | 13 |
* IMPORT start_storage_server |
| 13 | 14 |
* IMPORT start_page_actions_server |
| 14 | 15 |
* IMPORT browser |
| ... | ... | |
| 50 | 51 |
|
| 51 | 52 |
|
| 52 | 53 |
let storage; |
| 54 |
let policy_observable = {};
|
|
| 53 | 55 |
|
| 54 | 56 |
function on_headers_received(details) |
| 55 | 57 |
{
|
| ... | ... | |
| 58 | 60 |
return; |
| 59 | 61 |
|
| 60 | 62 |
const [pattern, settings] = query_best(storage, details.url); |
| 61 |
const allow = !!(settings && settings.allow);
|
|
| 63 |
const allow = !!(settings ? settings.allow : policy_observable.value);
|
|
| 62 | 64 |
const nonce = gen_nonce(); |
| 63 | 65 |
const policy = {allow, url, nonce};
|
| 64 | 66 |
|
| ... | ... | |
| 114 | 116 |
{urls: ["<all_urls>"], types: all_types},
|
| 115 | 117 |
extra_opts.concat("requestHeaders")
|
| 116 | 118 |
); |
| 119 |
|
|
| 120 |
policy_observable = await light_storage.observe_var("default_allow");
|
|
| 117 | 121 |
} |
| 118 | 122 |
|
| 119 | 123 |
start_webRequest_operations(); |
Also available in: Unified diff
enable toggling of global script blocking policy\n\nThis commit also introduces `light_storage' module which is later going to replace the storage code we use right now.\nAlso included is a hack to properly display scrollbars under Mozilla (needs testing on newer Mozilla browsers).