aboutsummaryrefslogtreecommitdiffstats
path: root/js/background.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/background.js')
-rw-r--r--js/background.js347
1 files changed, 173 insertions, 174 deletions
diff --git a/js/background.js b/js/background.js
index aad19e7..07065b7 100644
--- a/js/background.js
+++ b/js/background.js
@@ -27,61 +27,61 @@
var ηMatrix = (function() { // jshint ignore:line
-/******************************************************************************/
-
-var oneSecond = 1000;
-var oneMinute = 60 * oneSecond;
-var oneHour = 60 * oneMinute;
-var oneDay = 24 * oneHour;
-
-/******************************************************************************/
-/******************************************************************************/
-
-var _RequestStats = function() {
- 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;
-};
-
-/******************************************************************************/
-
-var RequestStats = function() {
- this.allowed = new _RequestStats();
- this.blocked = new _RequestStats();
-};
-
-RequestStats.prototype.reset = function() {
- this.blocked.reset();
- this.allowed.reset();
-};
-
-RequestStats.prototype.record = function(type, blocked) {
- // Remember: always test against **false**
- if ( blocked !== false ) {
- this.blocked[type] += 1;
- this.blocked.all += 1;
- } else {
- this.allowed[type] += 1;
- this.allowed.all += 1;
- }
-};
-
-var requestStatsFactory = function() {
- return new RequestStats();
-};
-
-/*******************************************************************************
+ /******************************************************************************/
+
+ var oneSecond = 1000;
+ var oneMinute = 60 * oneSecond;
+ var oneHour = 60 * oneMinute;
+ var oneDay = 24 * oneHour;
+
+ /******************************************************************************/
+ /******************************************************************************/
+
+ var _RequestStats = function() {
+ 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;
+ };
+
+ /******************************************************************************/
+
+ var RequestStats = function() {
+ this.allowed = new _RequestStats();
+ this.blocked = new _RequestStats();
+ };
+
+ RequestStats.prototype.reset = function() {
+ this.blocked.reset();
+ this.allowed.reset();
+ };
+
+ RequestStats.prototype.record = function(type, blocked) {
+ // Remember: always test against **false**
+ if ( blocked !== false ) {
+ this.blocked[type] += 1;
+ this.blocked.all += 1;
+ } else {
+ this.allowed[type] += 1;
+ this.allowed.all += 1;
+ }
+ };
+
+ var requestStatsFactory = function() {
+ return new RequestStats();
+ };
+
+ /*******************************************************************************
SVG-based icons below were extracted from
fontawesome-webfont.svg v4.7. Excerpt of copyright notice at
@@ -100,56 +100,56 @@ var requestStatsFactory = function() {
Font icons:
- glyph-name: "external_link"
-*/
+ */
-var rawSettingsDefault = {
- disableCSPReportInjection: false,
- placeholderBackground:
+ var rawSettingsDefault = {
+ disableCSPReportInjection: false,
+ placeholderBackground:
[
'url("data:image/png;base64,',
- 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAK',
- 'CAAAAACoWZBhAAAABGdBTUEAALGPC/xh',
- 'BQAAAAJiS0dEAP+Hj8y/AAAAB3RJTUUH',
- '3wwIAAgyL/YaPAAAACJJREFUCFtjfMbO',
- 'AAQ/gZiFnQPEBAEmGIMIJgtIL8QEgtoA',
- 'In4D/96X1KAAAAAldEVYdGRhdGU6Y3Jl',
- 'YXRlADIwMTUtMTItMDhUMDA6MDg6NTAr',
- 'MDM6MDAasuuJAAAAJXRFWHRkYXRlOm1v',
- 'ZGlmeQAyMDE1LTEyLTA4VDAwOjA4OjUw',
- 'KzAzOjAwa+9TNQAAAABJRU5ErkJggg==',
+ 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAK',
+ 'CAAAAACoWZBhAAAABGdBTUEAALGPC/xh',
+ 'BQAAAAJiS0dEAP+Hj8y/AAAAB3RJTUUH',
+ '3wwIAAgyL/YaPAAAACJJREFUCFtjfMbO',
+ 'AAQ/gZiFnQPEBAEmGIMIJgtIL8QEgtoA',
+ 'In4D/96X1KAAAAAldEVYdGRhdGU6Y3Jl',
+ 'YXRlADIwMTUtMTItMDhUMDA6MDg6NTAr',
+ 'MDM6MDAasuuJAAAAJXRFWHRkYXRlOm1v',
+ 'ZGlmeQAyMDE1LTEyLTA4VDAwOjA4OjUw',
+ 'KzAzOjAwa+9TNQAAAABJRU5ErkJggg==',
'") ',
'repeat scroll #fff'
].join(''),
- placeholderBorder: '1px solid rgba(0, 0, 0, 0.1)',
- imagePlaceholder: true,
- imagePlaceholderBackground: 'default',
- imagePlaceholderBorder: 'default',
- framePlaceholder: true,
- framePlaceholderDocument:
+ 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>',
'body { ',
- 'background: {{bg}};',
- 'color: gray;',
- 'font: 12px sans-serif;',
- 'margin: 0;',
- 'overflow: hidden;',
- 'padding: 2px;',
- 'white-space: nowrap;',
+ 'background: {{bg}};',
+ 'color: gray;',
+ 'font: 12px sans-serif;',
+ 'margin: 0;',
+ 'overflow: hidden;',
+ 'padding: 2px;',
+ 'white-space: nowrap;',
'}',
'a { ',
- 'color: inherit;',
- 'padding: 0 3px;',
- 'text-decoration: none;',
+ 'color: inherit;',
+ 'padding: 0 3px;',
+ 'text-decoration: none;',
'}',
'svg {',
- 'display: inline-block;',
- 'fill: gray;',
- 'height: 12px;',
- 'vertical-align: bottom;',
- 'width: 12px;',
+ 'display: inline-block;',
+ 'fill: gray;',
+ 'height: 12px;',
+ 'vertical-align: bottom;',
+ 'width: 12px;',
'}',
'</style></head><body>',
'<span><a href="{{url}}" title="{{url}}" target="_blank">',
@@ -157,91 +157,90 @@ var rawSettingsDefault = {
'</a>{{url}}</span>',
'</body></html>'
].join(''),
- framePlaceholderBackground: 'default',
-};
-
-/******************************************************************************/
-
-return {
- onBeforeStartQueue: [],
-
- userSettings: {
- alwaysDetachLogger: false,
- autoUpdate: false,
- clearBrowserCache: true,
- clearBrowserCacheAfter: 60,
- cloudStorageEnabled: false,
- collapseBlacklisted: true,
- collapseBlocked: false,
- colorBlindFriendly: false,
- deleteCookies: false,
- deleteUnusedSessionCookies: false,
- deleteUnusedSessionCookiesAfter: 60,
- deleteLocalStorage: false,
- displayTextSize: '14px',
- externalHostsFiles: '',
- iconBadgeEnabled: false,
- maxLoggedRequests: 1000,
- popupCollapseAllDomains: false,
- popupCollapseBlacklistedDomains: false,
- popupScopeLevel: 'domain',
- processHyperlinkAuditing: true,
- processReferer: false
- },
-
- 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: null,
-
- // 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(){},
-
- // so that I don't have to care for last comma
- dummy: 0
-};
-
-/******************************************************************************/
+ framePlaceholderBackground: 'default',
+ };
+
+ /******************************************************************************/
+
+ return {
+ onBeforeStartQueue: [],
+
+ userSettings: {
+ alwaysDetachLogger: false,
+ autoUpdate: false,
+ clearBrowserCache: true,
+ clearBrowserCacheAfter: 60,
+ cloudStorageEnabled: false,
+ collapseBlacklisted: true,
+ collapseBlocked: false,
+ colorBlindFriendly: false,
+ deleteCookies: false,
+ deleteUnusedSessionCookies: false,
+ deleteUnusedSessionCookiesAfter: 60,
+ deleteLocalStorage: false,
+ displayTextSize: '14px',
+ externalHostsFiles: '',
+ iconBadgeEnabled: false,
+ maxLoggedRequests: 1000,
+ popupCollapseAllDomains: false,
+ popupCollapseBlacklistedDomains: false,
+ popupScopeLevel: 'domain',
+ processHyperlinkAuditing: true,
+ processReferer: false
+ },
+
+ 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: null,
+
+ // 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(){},
+
+ // so that I don't have to care for last comma
+ dummy: 0
+ };
+
+ /******************************************************************************/
})();
/******************************************************************************/
-