diff options
author | Jesús <heckyel@hyperbola.info> | 2022-04-06 10:38:06 +0800 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2022-04-06 10:38:06 +0800 |
commit | 8aeb670be1d252807252ee2bfe99b15b81c3e28d (patch) | |
tree | ced0973165449d620c5c40876c37ab16b17655f9 /js/background.js | |
parent | 5aa99a2ea2b683ba35eb36dfc54efd79f3cfcb85 (diff) | |
download | ematrix-8aeb670be1d252807252ee2bfe99b15b81c3e28d.tar.lz ematrix-8aeb670be1d252807252ee2bfe99b15b81c3e28d.tar.xz ematrix-8aeb670be1d252807252ee2bfe99b15b81c3e28d.zip |
update from upstream
Diffstat (limited to 'js/background.js')
-rw-r--r-- | js/background.js | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/js/background.js b/js/background.js index 889decd..b31bbed 100644 --- a/js/background.js +++ b/js/background.js @@ -2,7 +2,7 @@ ηMatrix - a browser extension to black/white list requests. Copyright (C) 2014-2019 Raymond Hill - Copyright (C) 2019-2020 Alessio Vanni + Copyright (C) 2019-2022 Alessio Vanni 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 @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see {http://www.gnu.org/licenses/}. - Home: https://libregit.spks.xyz/heckyel/ematrix + Home: https://gitlab.com/vannilla/ematrix uMatrix Home: https://github.com/gorhill/uMatrix */ @@ -32,45 +32,45 @@ var ηMatrix = (function () { let oneDay = 24 * oneHour; let _RequestStats = function () { - this.reset(); + this.reset(); }; _RequestStats.prototype.reset = function () { - this.all = - this.doc = - this.frame = - this.script = - this.css = - this.image = - this.media = - this.xhr = - this.other = - this.cookie = 0; + this.all = + this.doc = + this.frame = + this.script = + this.css = + this.image = + this.media = + this.xhr = + this.other = + this.cookie = 0; }; var RequestStats = function () { - this.allowed = new _RequestStats (); - this.blocked = new _RequestStats (); + this.allowed = new _RequestStats (); + this.blocked = new _RequestStats (); }; RequestStats.prototype.reset = function () { - this.blocked.reset(); - this.allowed.reset(); + this.blocked.reset(); + this.allowed.reset(); }; RequestStats.prototype.record = function (type, blocked) { - // Remember: always test against **false** - if (blocked !== false) { + // Remember: always test against **false** + if (blocked !== false) { this.blocked[type] += 1; this.blocked.all += 1; - } else { + } else { this.allowed[type] += 1; this.allowed.all += 1; - } + } }; var requestStatsFactory = function () { - return new RequestStats(); + return new RequestStats(); }; /** @@ -93,8 +93,8 @@ var ηMatrix = (function () { */ var rawSettingsDefault = { - disableCSPReportInjection: false, - placeholderBackground: [ + disableCSPReportInjection: false, + placeholderBackground: [ 'url("data:image/png;base64,', 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAK', 'CAAAAACoWZBhAAAABGdBTUEAALGPC/xh', @@ -108,13 +108,13 @@ var ηMatrix = (function () { 'KzAzOjAwa+9TNQAAAABJRU5ErkJggg==', '") ', 'repeat scroll #fff' - ].join(''), - placeholderBorder: '1px solid rgba(0, 0, 0, 0.1)', - imagePlaceholder: true, - imagePlaceholderBackground: 'default', - imagePlaceholderBorder: 'default', - framePlaceholder: true, - framePlaceholderDocument: [ + ].join(''), + placeholderBorder: '1px solid rgba(0, 0, 0, 0.1)', + imagePlaceholder: true, + imagePlaceholderBackground: 'default', + imagePlaceholderBorder: 'default', + framePlaceholder: true, + framePlaceholderDocument: [ '<html><head>', '<meta charset="utf-8">', '<style>', @@ -145,13 +145,13 @@ var ηMatrix = (function () { '</a>{{url}}</span>', '</body></html>' ].join(''), - framePlaceholderBackground: 'default', + framePlaceholderBackground: 'default', }; return { - onBeforeStartQueue: [], + onBeforeStartQueue: [], - userSettings: { + userSettings: { alwaysDetachLogger: false, autoUpdate: false, clearBrowserCache: true, @@ -173,56 +173,56 @@ var ηMatrix = (function () { popupScopeLevel: 'domain', processHyperlinkAuditing: true, processReferer: false, - disableUpdateIcon: false, - resolveCname: false, - assetsVersion: 1, - }, - - rawSettingsDefault: rawSettingsDefault, - rawSettings: Object.assign({}, rawSettingsDefault), - rawSettingsWriteTime: 0, - - clearBrowserCacheCycle: 0, - cspNoInlineScript: "script-src 'unsafe-eval' blob: *", - cspNoInlineStyle: "style-src blob: *", - cspNoWorker: undefined, - updateAssetsEvery: 11 * oneDay + 1 * oneHour + 1 * oneMinute + 1 * oneSecond, - firstUpdateAfter: 11 * oneMinute, - nextUpdateAfter: 11 * oneHour, - assetsBootstrapLocation: 'assets/assets.json', - pslAssetKey: 'public_suffix_list.dat', - - // list of live hosts files - liveHostsFiles: { - }, - - // urls stats are kept on the back burner while waiting to be - // reactivated in a tab or another. - pageStores: {}, - pageStoresToken: 0, - pageStoreCemetery: {}, - - // page url => permission scope - tMatrix: null, - pMatrix: null, - - ubiquitousBlacklist: new LiquidDict(), - ubiquitousWhitelist: new LiquidDict(), - - // various stats - requestStatsFactory: requestStatsFactory, - requestStats: requestStatsFactory(), - cookieRemovedCounter: 0, - localStorageRemovedCounter: 0, - cookieHeaderFoiledCounter: 0, - refererHeaderFoiledCounter: 0, - hyperlinkAuditingFoiledCounter: 0, - browserCacheClearedCounter: 0, - storageUsed: 0, - - // record what the browser is doing behind the scene - behindTheSceneScope: 'behind-the-scene', - - noopFunc: function () {}, + disableUpdateIcon: false, + resolveCname: false, + assetsVersion: 1, + }, + + rawSettingsDefault: rawSettingsDefault, + rawSettings: Object.assign({}, rawSettingsDefault), + rawSettingsWriteTime: 0, + + clearBrowserCacheCycle: 0, + cspNoInlineScript: "script-src 'unsafe-eval' blob: *", + cspNoInlineStyle: "style-src blob: *", + cspNoWorker: undefined, + updateAssetsEvery: 11 * oneDay + 1 * oneHour + 1 * oneMinute + 1 * oneSecond, + firstUpdateAfter: 11 * oneMinute, + nextUpdateAfter: 11 * oneHour, + assetsBootstrapLocation: 'assets/assets.json', + pslAssetKey: 'public_suffix_list.dat', + + // list of live hosts files + liveHostsFiles: { + }, + + // urls stats are kept on the back burner while waiting to be + // reactivated in a tab or another. + pageStores: {}, + pageStoresToken: 0, + pageStoreCemetery: {}, + + // page url => permission scope + tMatrix: null, + pMatrix: null, + + ubiquitousBlacklist: new LiquidDict(), + ubiquitousWhitelist: new LiquidDict(), + + // various stats + requestStatsFactory: requestStatsFactory, + requestStats: requestStatsFactory(), + cookieRemovedCounter: 0, + localStorageRemovedCounter: 0, + cookieHeaderFoiledCounter: 0, + refererHeaderFoiledCounter: 0, + hyperlinkAuditingFoiledCounter: 0, + browserCacheClearedCounter: 0, + storageUsed: 0, + + // record what the browser is doing behind the scene + behindTheSceneScope: 'behind-the-scene', + + noopFunc: function () {}, }; })(); |