aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js/settings')
-rw-r--r--ext/bg/js/settings/backup.js8
-rw-r--r--ext/bg/js/settings/settings-controller.js17
2 files changed, 12 insertions, 13 deletions
diff --git a/ext/bg/js/settings/backup.js b/ext/bg/js/settings/backup.js
index e93e15bf..13f90886 100644
--- a/ext/bg/js/settings/backup.js
+++ b/ext/bg/js/settings/backup.js
@@ -141,7 +141,7 @@ class SettingsBackup {
// Importing
async _settingsImportSetOptionsFull(optionsFull) {
- await this._settingsController.setOptionsFull(optionsFull);
+ await this._settingsController.setAllSettings(optionsFull);
}
_showSettingsImportError(error) {
@@ -340,9 +340,6 @@ class SettingsBackup {
// Assign options
await this._settingsImportSetOptionsFull(optionsFull);
-
- // Reload settings page
- window.location.reload();
}
_onSettingsImportClick() {
@@ -376,8 +373,5 @@ class SettingsBackup {
// Assign options
await this._settingsImportSetOptionsFull(optionsFull);
-
- // Reload settings page
- window.location.reload();
}
}
diff --git a/ext/bg/js/settings/settings-controller.js b/ext/bg/js/settings/settings-controller.js
index 9224aedf..4c902dff 100644
--- a/ext/bg/js/settings/settings-controller.js
+++ b/ext/bg/js/settings/settings-controller.js
@@ -38,9 +38,7 @@ class SettingsController extends EventDispatcher {
set profileIndex(value) {
if (this._profileIndex === value) { return; }
- this._profileIndex = value;
- this.trigger('optionsContextChanged');
- this._onOptionsUpdatedInternal();
+ this._setProfileIndex(value);
}
prepare() {
@@ -69,9 +67,10 @@ class SettingsController extends EventDispatcher {
return utilBackend().getFullOptions();
}
- async setOptionsFull(optionsFull) {
- utilBackend().setFullOptions(utilBackgroundIsolate(optionsFull));
- await this.save();
+ async setAllSettings(value) {
+ const profileIndex = value.profileCurrent;
+ await api.setAllSettings(value, this._source);
+ this._setProfileIndex(profileIndex);
}
async getGlobalSettings(targets) {
@@ -104,6 +103,12 @@ class SettingsController extends EventDispatcher {
// Private
+ _setProfileIndex(value) {
+ this._profileIndex = value;
+ this.trigger('optionsContextChanged');
+ this._onOptionsUpdatedInternal();
+ }
+
_onOptionsUpdated({source}) {
if (source === this._source) { return; }
this._onOptionsUpdatedInternal();