diff options
author | Jesús <heckyel@hyperbola.info> | 2019-12-30 15:55:13 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-12-30 15:55:13 -0500 |
commit | 288df6a7bf8b933e2dc499e38f4915fcf974c14b (patch) | |
tree | 77bba994f260c064d3ee7f76c427ddfaa4f91710 /js/background.js | |
parent | a2c9deaa145b780722e93b3899600f287c8094a4 (diff) | |
download | ematrix-288df6a7bf8b933e2dc499e38f4915fcf974c14b.tar.lz ematrix-288df6a7bf8b933e2dc499e38f4915fcf974c14b.tar.xz ematrix-288df6a7bf8b933e2dc499e38f4915fcf974c14b.zip |
backport
- Flush caches on upgrade
- Properly handle FrameModule's unloading
- Use the new module and remove the old implementation
Diffstat (limited to 'js/background.js')
-rw-r--r-- | js/background.js | 94 |
1 files changed, 37 insertions, 57 deletions
diff --git a/js/background.js b/js/background.js index 07065b7..7ac9ef2 100644 --- a/js/background.js +++ b/js/background.js @@ -23,25 +23,19 @@ 'use strict'; -/******************************************************************************/ +var ηMatrix = (function () { + Cu.import('chrome://ematrix/content/lib/LiquidDict.jsm'); -var ηMatrix = (function() { // jshint ignore:line + let oneSecond = 1000; + let oneMinute = 60 * oneSecond; + let oneHour = 60 * oneMinute; + let oneDay = 24 * oneHour; - /******************************************************************************/ - - var oneSecond = 1000; - var oneMinute = 60 * oneSecond; - var oneHour = 60 * oneMinute; - var oneDay = 24 * oneHour; - - /******************************************************************************/ - /******************************************************************************/ - - var _RequestStats = function() { + let _RequestStats = function () { this.reset(); }; - _RequestStats.prototype.reset = function() { + _RequestStats.prototype.reset = function () { this.all = this.doc = this.frame = @@ -54,21 +48,19 @@ var ηMatrix = (function() { // jshint ignore:line this.cookie = 0; }; - /******************************************************************************/ - - var RequestStats = function() { - this.allowed = new _RequestStats(); - this.blocked = new _RequestStats(); + var RequestStats = function () { + this.allowed = new _RequestStats (); + this.blocked = new _RequestStats (); }; - RequestStats.prototype.reset = function() { + RequestStats.prototype.reset = function () { this.blocked.reset(); this.allowed.reset(); }; - RequestStats.prototype.record = function(type, blocked) { + RequestStats.prototype.record = function (type, blocked) { // Remember: always test against **false** - if ( blocked !== false ) { + if (blocked !== false) { this.blocked[type] += 1; this.blocked.all += 1; } else { @@ -77,35 +69,32 @@ var ηMatrix = (function() { // jshint ignore:line } }; - var requestStatsFactory = function() { + var requestStatsFactory = function () { return new RequestStats(); }; - /******************************************************************************* - - SVG-based icons below were extracted from - fontawesome-webfont.svg v4.7. Excerpt of copyright notice at - the top of the file: - - > Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 - > By ,,, - > Copyright Dave Gandy 2016. All rights reserved. + /** + SVG-based icons below were extracted from + fontawesome-webfont.svg v4.7. Excerpt of copyright notice at + the top of the file: - Excerpt of the license information in the fontawesome CSS - file bundled with the package: + > Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + > By ,,, + > Copyright Dave Gandy 2016. All rights reserved. - > Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome - > License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + Excerpt of the license information in the fontawesome CSS + file bundled with the package: - Font icons: - - glyph-name: "external_link" + > Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + > License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + Font icons: + - glyph-name: "external_link" */ var rawSettingsDefault = { disableCSPReportInjection: false, - placeholderBackground: - [ + placeholderBackground: [ 'url("data:image/png;base64,', 'iVBORw0KGgoAAAANSUhEUgAAAAoAAAAK', 'CAAAAACoWZBhAAAABGdBTUEAALGPC/xh', @@ -125,8 +114,7 @@ var ηMatrix = (function() { // jshint ignore:line imagePlaceholderBackground: 'default', imagePlaceholderBorder: 'default', framePlaceholder: true, - framePlaceholderDocument: - [ + framePlaceholderDocument: [ '<html><head>', '<meta charset="utf-8">', '<style>', @@ -160,8 +148,6 @@ var ηMatrix = (function() { // jshint ignore:line framePlaceholderBackground: 'default', }; - /******************************************************************************/ - return { onBeforeStartQueue: [], @@ -186,7 +172,8 @@ var ηMatrix = (function() { // jshint ignore:line popupCollapseBlacklistedDomains: false, popupScopeLevel: 'domain', processHyperlinkAuditing: true, - processReferer: false + processReferer: false, + disableUpdateIcon: false, }, rawSettingsDefault: rawSettingsDefault, @@ -207,8 +194,8 @@ var ηMatrix = (function() { // jshint ignore:line liveHostsFiles: { }, - // urls stats are kept on the back burner while waiting to be reactivated - // in a tab or another. + // urls stats are kept on the back burner while waiting to be + // reactivated in a tab or another. pageStores: {}, pageStoresToken: 0, pageStoreCemetery: {}, @@ -217,7 +204,8 @@ var ηMatrix = (function() { // jshint ignore:line tMatrix: null, pMatrix: null, - ubiquitousBlacklist: null, + ubiquitousBlacklist: new LiquidDict(), + ubiquitousWhitelist: new LiquidDict(), // various stats requestStatsFactory: requestStatsFactory, @@ -233,14 +221,6 @@ var ηMatrix = (function() { // jshint ignore:line // 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 + noopFunc: function () {}, }; - - /******************************************************************************/ - })(); - -/******************************************************************************/ |