Revision 6247f163
Added by koszko about 2 years ago
background/page_actions_server.js | ||
---|---|---|
8 | 8 |
/* |
9 | 9 |
* IMPORTS_START |
10 | 10 |
* IMPORT get_storage |
11 |
* IMPORT light_storage |
|
11 | 12 |
* IMPORT TYPE_PREFIX |
12 | 13 |
* IMPORT CONNECTION_TYPE |
13 | 14 |
* IMPORT browser |
... | ... | |
20 | 21 |
|
21 | 22 |
var storage; |
22 | 23 |
var handler; |
24 |
let policy_observable; |
|
23 | 25 |
|
24 | 26 |
function send_actions(url, port) |
25 | 27 |
{ |
26 |
const [pattern, settings] = query_best(storage, url); |
|
28 |
let [pattern, settings] = query_best(storage, url); |
|
29 |
if (!settings) |
|
30 |
settings = {allow: policy_observable && policy_observable.value}; |
|
27 | 31 |
const repos = storage.get_all(TYPE_PREFIX.REPO); |
28 | 32 |
|
29 | 33 |
port.postMessage(["settings", [pattern, settings, repos]]); |
30 | 34 |
|
31 |
if (settings === undefined) |
|
32 |
return; |
|
33 |
|
|
34 | 35 |
let components = settings.components; |
35 | 36 |
let processed_bags = new Set(); |
36 | 37 |
|
... | ... | |
127 | 128 |
storage = await get_storage(); |
128 | 129 |
|
129 | 130 |
listen_for_connection(CONNECTION_TYPE.PAGE_ACTIONS, new_connection); |
131 |
|
|
132 |
policy_observable = await light_storage.observe_var("default_allow"); |
|
130 | 133 |
} |
131 | 134 |
|
132 | 135 |
/* |
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).