Skip to content

Commit

Permalink
feat: add cacheStorage and remove serverBoundCertificates in Chrome a…
Browse files Browse the repository at this point in the history
…nd Opera

BREAKING CHANGE: browser versions before Chrome 76, Firefox 68 and Opera 63
are no longer supported.
  • Loading branch information
dessant committed Nov 15, 2019
1 parent 3e771bb commit c102d6c
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 27 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"release": "standard-version"
},
"browserslist": [
"Chrome >= 55",
"Firefox >= 57",
"Opera >= 42"
"Chrome >= 76",
"Firefox >= 68",
"Opera >= 63"
],
"dependencies": {
"@material/icon-button": "^4.0.0",
Expand Down
30 changes: 15 additions & 15 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
"description": "Title of the action."
},

"actionTitle_cacheStorage": {
"message": "Clear cache storage",
"description": "Title of the action."
},

"actionTitle_cookies": {
"message": "Clear cookies",
"description": "Title of the action."
Expand Down Expand Up @@ -64,11 +69,6 @@
"description": "Title of the action."
},

"actionTitle_serverBoundCertificates": {
"message": "Clear server-bound certificates",
"description": "Title of the action."
},

"actionTitle_serviceWorkers": {
"message": "Clear Service Workers",
"description": "Title of the action."
Expand All @@ -94,6 +94,11 @@
"description": "Title of the menu item."
},

"menuItemTitle_cacheStorage": {
"message": "Cache storage",
"description": "Title of the menu item."
},

"menuItemTitle_cookies": {
"message": "Cookies",
"description": "Title of the menu item."
Expand Down Expand Up @@ -139,11 +144,6 @@
"description": "Title of the menu item."
},

"menuItemTitle_serverBoundCertificates": {
"message": "Server-bound certificates",
"description": "Title of the menu item."
},

"menuItemTitle_serviceWorkers": {
"message": "Service Workers",
"description": "Title of the menu item."
Expand Down Expand Up @@ -179,6 +179,11 @@
"description": "Title of the option."
},

"optionTitle_cacheStorage": {
"message": "Cache storage data",
"description": "Title of the option."
},

"optionTitle_cookies": {
"message": "Cookies",
"description": "Title of the option."
Expand Down Expand Up @@ -229,11 +234,6 @@
"description": "Title of the option."
},

"optionTitle_serverBoundCertificates": {
"message": "Server-bound certificates",
"description": "Title of the option."
},

"optionTitle_webSQL": {
"message": "Web SQL data",
"description": "Title of the option."
Expand Down
4 changes: 4 additions & 0 deletions src/icons/dataTypes/cacheStorage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions src/icons/dataTypes/serverBoundCertificates.svg

This file was deleted.

6 changes: 3 additions & 3 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"applications": {
"gecko": {
"id": "{ce9f4b1f-24b8-4e9a-9051-b9e472b1b2f2}",
"strict_min_version": "57.0"
"strict_min_version": "68.0"
}
},
"minimum_chrome_version": "55.0",
"minimum_opera_version": "42.0",
"minimum_chrome_version": "76.0",
"minimum_opera_version": "63.0",

"permissions": ["browsingData", "notifications", "storage"],

Expand Down
60 changes: 60 additions & 0 deletions src/storage/versions/local/aPSasaNb4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import browser from 'webextension-polyfill';

import {targetEnv} from 'utils/config';

const message = 'Add cacheStorage and remove serverBoundCertificates in Chrome';

const revision = 'aPSasaNb4';
const downRevision = 'kuZ4zBZDX';

const storage = browser.storage.local;

async function upgrade() {
const changes = {};

if (targetEnv !== 'firefox') {
const {dataTypes, disabledDataTypes} = await storage.get([
'dataTypes',
'disabledDataTypes'
]);

dataTypes.splice(dataTypes.indexOf('cache') + 1, 0, 'cacheStorage');

changes.dataTypes = dataTypes.filter(function(item) {
return item !== 'serverBoundCertificates';
});
changes.disabledDataTypes = disabledDataTypes.filter(function(item) {
return item !== 'serverBoundCertificates';
});
}

changes.storageVersion = revision;
return storage.set(changes);
}

async function downgrade() {
const changes = {};

const {dataTypes, disabledDataTypes} = await storage.get([
'dataTypes',
'disabledDataTypes'
]);

if (targetEnv !== 'firefox') {
changes.dataTypes = dataTypes
.filter(function(item) {
return item !== 'cacheStorage';
})
.concat('serverBoundCertificates');
changes.disabledDataTypes = disabledDataTypes
.filter(function(item) {
return item !== 'cacheStorage';
})
.concat('serverBoundCertificates');
}

changes.storageVersion = downRevision;
return storage.set(changes);
}

export {message, revision, upgrade, downgrade};
2 changes: 1 addition & 1 deletion src/storage/versions/local/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"versions": ["xO0Hh1Vm2", "BkFsUtt7f", "ByCtvupNz", "kuZ4zBZDX"]}
{"versions": ["xO0Hh1Vm2", "BkFsUtt7f", "ByCtvupNz", "kuZ4zBZDX", "aPSasaNb4"]}
60 changes: 60 additions & 0 deletions src/storage/versions/sync/aPSasaNb4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import browser from 'webextension-polyfill';

import {targetEnv} from 'utils/config';

const message = 'Add cacheStorage and remove serverBoundCertificates in Chrome';

const revision = 'aPSasaNb4';
const downRevision = 'kuZ4zBZDX';

const storage = browser.storage.sync;

async function upgrade() {
const changes = {};

if (targetEnv !== 'firefox') {
const {dataTypes, disabledDataTypes} = await storage.get([
'dataTypes',
'disabledDataTypes'
]);

dataTypes.splice(dataTypes.indexOf('cache') + 1, 0, 'cacheStorage');

changes.dataTypes = dataTypes.filter(function(item) {
return item !== 'serverBoundCertificates';
});
changes.disabledDataTypes = disabledDataTypes.filter(function(item) {
return item !== 'serverBoundCertificates';
});
}

changes.storageVersion = revision;
return storage.set(changes);
}

async function downgrade() {
const changes = {};

const {dataTypes, disabledDataTypes} = await storage.get([
'dataTypes',
'disabledDataTypes'
]);

if (targetEnv !== 'firefox') {
changes.dataTypes = dataTypes
.filter(function(item) {
return item !== 'cacheStorage';
})
.concat('serverBoundCertificates');
changes.disabledDataTypes = disabledDataTypes
.filter(function(item) {
return item !== 'cacheStorage';
})
.concat('serverBoundCertificates');
}

changes.storageVersion = downRevision;
return storage.set(changes);
}

export {message, revision, upgrade, downgrade};
2 changes: 1 addition & 1 deletion src/storage/versions/sync/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"versions": ["xO0Hh1Vm2", "BkFsUtt7f", "ByCtvupNz", "kuZ4zBZDX"]}
{"versions": ["xO0Hh1Vm2", "BkFsUtt7f", "ByCtvupNz", "kuZ4zBZDX", "aPSasaNb4"]}

0 comments on commit c102d6c

Please sign in to comment.