diff --git a/src/core/background/migration.js b/src/core/background/migration.js index bdad2372..29637b99 100644 --- a/src/core/background/migration.js +++ b/src/core/background/migration.js @@ -186,12 +186,27 @@ class Migration { await this.storage.persist(); } if (versionCompare('0.103', previousVersion) >= 0) { - debug('updated from version <= 0.103, possibly set deletesHistory.active'); + debug('updated from version <= 0.103, migrate deletesHistory.active and ignoreRequestsTo'); const history = await browser.permissions.contains({permissions: ['history']}); if (history) { this.storage.local.preferences.deletesHistory.active = true; - await this.storage.persist(); } + + if (this.storage.local.preferences.ignoreRequestsToAMO === false) { + this.storage.local.preferences.ignoreRequests = + this.storage.local.preferences.ignoreRequests.filter(ignoredPattern => + ignoredPattern !== 'addons.mozilla.org' + ); + } + if (this.storage.local.preferences.ignoreRequestsToPocket === false) { + this.storage.local.preferences.ignoreRequests = + this.storage.local.preferences.ignoreRequests.filter(ignoredPattern => + ignoredPattern !== 'getpocket.com' + ); + } + delete this.storage.local.preferences.ignoreRequestsToAMO; + delete this.storage.local.preferences.ignoreRequestsToPocket; + await this.storage.persist(); } } } diff --git a/src/core/background/request.js b/src/core/background/request.js index 6393e76a..530400fb 100644 --- a/src/core/background/request.js +++ b/src/core/background/request.js @@ -134,16 +134,11 @@ class TmpRequest { this.container.maybeAddHistory(tab, request.url); - if ((request.url.startsWith('http://addons.mozilla.org') || - request.url.startsWith('https://addons.mozilla.org')) && - this.storage.local.preferences.ignoreRequestsToAMO) { - debug('[_webRequestOnBeforeRequest] we are ignoring requests to addons.mozilla.org because we arent allowed to cancel requests anyway', request); - return; - } - - if (request.url.startsWith('https://getpocket.com') && - this.storage.local.preferences.ignoreRequestsToPocket) { - debug('[_webRequestOnBeforeRequest] we are ignoring requests to getpocket.com because of #52', request); + if (this.storage.local.preferences.ignoreRequests.length && + this.storage.local.preferences.ignoreRequests.find(ignorePattern => { + return this.isolation.matchDomainPattern(request.url, ignorePattern); + })) { + debug('[_webRequestOnBeforeRequest] request url is on the ignoreRequests list', request); return; } diff --git a/src/core/background/storage.js b/src/core/background/storage.js index 08393265..ef5d4a43 100644 --- a/src/core/background/storage.js +++ b/src/core/background/storage.js @@ -64,8 +64,7 @@ class TmpStorage { delay: 2000, domains: ['t.co', 'outgoing.prod.mozaws.net'] }, - ignoreRequestsToAMO: true, - ignoreRequestsToPocket: true, + ignoreRequests: ['getpocket.com', 'addons.mozilla.org'], cookies: { domain: {} }, diff --git a/src/ui/components/advanced/general.vue b/src/ui/components/advanced/general.vue index f628e6b0..e1fe5c31 100644 --- a/src/ui/components/advanced/general.vue +++ b/src/ui/components/advanced/general.vue @@ -1,5 +1,10 @@ + +