-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add cacheStorage and remove serverBoundCertificates in Chrome a…
…nd Opera BREAKING CHANGE: browser versions before Chrome 76, Firefox 68 and Opera 63 are no longer supported.
- Loading branch information
Showing
9 changed files
with
147 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"versions": ["xO0Hh1Vm2", "BkFsUtt7f", "ByCtvupNz", "kuZ4zBZDX"]} | ||
{"versions": ["xO0Hh1Vm2", "BkFsUtt7f", "ByCtvupNz", "kuZ4zBZDX", "aPSasaNb4"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"versions": ["xO0Hh1Vm2", "BkFsUtt7f", "ByCtvupNz", "kuZ4zBZDX"]} | ||
{"versions": ["xO0Hh1Vm2", "BkFsUtt7f", "ByCtvupNz", "kuZ4zBZDX", "aPSasaNb4"]} |