2022-11-16 03:28:54 -08:00
|
|
|
/* global policy, scripting, request */
|
2022-11-14 03:01:49 -08:00
|
|
|
|
2022-11-16 03:28:54 -08:00
|
|
|
self.importScripts('./policy.js');
|
|
|
|
self.importScripts('./scripting.js');
|
|
|
|
self.importScripts('./request.js');
|
2022-11-14 03:01:49 -08:00
|
|
|
|
2022-11-16 03:28:54 -08:00
|
|
|
// run on each wake up
|
|
|
|
policy.configure(scripting.commit, request.network);
|
2022-11-14 03:01:49 -08:00
|
|
|
|
2022-11-16 03:28:54 -08:00
|
|
|
// run once
|
|
|
|
{
|
|
|
|
const once = () => policy.configure(scripting.page);
|
2022-11-14 03:01:49 -08:00
|
|
|
|
2022-11-16 03:28:54 -08:00
|
|
|
chrome.runtime.onStartup.addListener(once);
|
|
|
|
chrome.runtime.onInstalled.addListener(once);
|
|
|
|
}
|
2022-11-14 03:01:49 -08:00
|
|
|
|
2022-11-16 03:28:54 -08:00
|
|
|
chrome.storage.onChanged.addListener(ps => {
|
|
|
|
if (ps.enabled || ps.mode || ps['blacklist-exception-hosts'] || ps['whitelist-hosts']) {
|
|
|
|
policy.configure(scripting.commit, scripting.page, request.network);
|
2022-11-14 03:01:49 -08:00
|
|
|
}
|
|
|
|
});
|