From 9641747ba173eb6cc64b5881759d225253935e4a Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sun, 27 Oct 2019 23:02:41 +0200 Subject: Revert "modify correct profile apiOptionsSet" This reverts commit 51c35c9f306e48093fc769713675dca5b02d1398. --- ext/bg/js/api.js | 4 ++-- ext/bg/js/backend.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'ext') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 95787d7d..6c109614 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -23,7 +23,7 @@ function apiOptionsGet(optionsContext) { async function apiOptionsSet(changedOptions, optionsContext, source) { const backend = utilBackend(); - const {profileIndex} = backend.getProfileFromContext(optionsContext); + const {depth} = optionsContext; let options = await apiOptionsGetFull(); function getValuePaths(obj) { @@ -63,7 +63,7 @@ async function apiOptionsSet(changedOptions, optionsContext, source) { } for (let [value, path] of getValuePaths(changedOptions)) { - modifyOption(path, value, options.profiles[profileIndex].options); + modifyOption(path, value, options.profiles[depth].options); } await optionsSave(options); diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 6d2e736e..71393467 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -122,15 +122,15 @@ class Backend { if (typeof optionsContext.index === 'number') { return profiles[optionsContext.index]; } - const {profile} = this.getProfileFromContext(optionsContext); + const profile = this.getProfileFromContext(optionsContext); return profile !== null ? profile : this.options.profiles[this.options.profileCurrent]; } getProfileFromContext(optionsContext) { - for (const [profileIndex, profile] of this.options.profiles.entries()) { + for (const profile of this.options.profiles) { const conditionGroups = profile.conditionGroups; if (conditionGroups.length > 0 && Backend.testConditionGroups(conditionGroups, optionsContext)) { - return {profileIndex, profile}; + return profile; } } return null; -- cgit v1.2.3