diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-09-04 17:44:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 17:44:00 -0400 |
commit | f3dd2270a5e93614f1b16a0f217b67b7f23059d9 (patch) | |
tree | 89a997c9a8ea8fdc4c0c4aeecdfd898a5e19224f /ext/bg/js/options.js | |
parent | 74edf462ab18e851e1e9ff0535b9979909dd98f7 (diff) |
Json schema profile conditions (#758)
* Add clearCache function
* Add upgrade
* Use schema-based profile condition validation
* Update profile conditions settings controller
* Remove unnecessary async
* Remove old
* Remove unused templates
Diffstat (limited to 'ext/bg/js/options.js')
-rw-r--r-- | ext/bg/js/options.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 0d83f428..c513f572 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -389,6 +389,10 @@ class OptionsUtil { { async: true, update: this._updateVersion3.bind(this) + }, + { + async: false, + update: this._updateVersion4.bind(this) } ]; } @@ -459,4 +463,22 @@ class OptionsUtil { } return fieldTemplates; } + + static _updateVersion4(options) { + // Version 4 changes: + // Options conditions converted to string representations. + for (const {conditionGroups} of options.profiles) { + for (const {conditions} of conditionGroups) { + for (const condition of conditions) { + const value = condition.value; + condition.value = ( + Array.isArray(value) ? + value.join(', ') : + `${value}` + ); + } + } + } + return options; + } } |