diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-17 21:23:21 -0400 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-09-18 19:14:04 -0400 | 
| commit | 352d214203fba929594c6139189fa59c6772c69f (patch) | |
| tree | da0e2be5103cdca6b1c4fb80b2e6eb34d821895d /ext/bg/js | |
| parent | dcfe722ba626a439db621385005aaa57b61835ca (diff) | |
Isolate objects to background window
Diffstat (limited to 'ext/bg/js')
| -rw-r--r-- | ext/bg/js/conditions-ui.js | 15 | ||||
| -rw-r--r-- | ext/bg/js/settings-profiles.js | 1 | 
2 files changed, 13 insertions, 3 deletions
| diff --git a/ext/bg/js/conditions-ui.js b/ext/bg/js/conditions-ui.js index 9b161c95..a6f54a1c 100644 --- a/ext/bg/js/conditions-ui.js +++ b/ext/bg/js/conditions-ui.js @@ -56,6 +56,11 @@ ConditionsUI.Container = class Container {          // Override      } +    isolate(object) { +        // Override +        return object; +    } +      remove(child) {          const index = this.children.indexOf(child);          if (index < 0) { @@ -68,9 +73,9 @@ ConditionsUI.Container = class Container {      }      onAddConditionGroup() { -        const conditionGroup = { +        const conditionGroup = this.isolate({              conditions: [this.createDefaultCondition(this.conditionNameDefault)] -        }; +        });          this.conditionGroups.push(conditionGroup);          this.save();          this.children.push(new ConditionsUI.ConditionGroup(this, conditionGroup)); @@ -139,6 +144,10 @@ ConditionsUI.ConditionGroup = class ConditionGroup {          this.parent.save();      } +    isolate(object) { +        return this.parent.isolate(object); +    } +      remove(child) {          const index = this.children.indexOf(child);          if (index < 0) { @@ -155,7 +164,7 @@ ConditionsUI.ConditionGroup = class ConditionGroup {      }      onAddCondition() { -        const condition = this.parent.createDefaultCondition(this.parent.conditionNameDefault); +        const condition = this.isolate(this.parent.createDefaultCondition(this.parent.conditionNameDefault));          this.conditionGroup.conditions.push(condition);          this.children.push(new ConditionsUI.Condition(this, condition));      } diff --git a/ext/bg/js/settings-profiles.js b/ext/bg/js/settings-profiles.js index 8796770d..ededc998 100644 --- a/ext/bg/js/settings-profiles.js +++ b/ext/bg/js/settings-profiles.js @@ -98,6 +98,7 @@ async function profileFormWrite(optionsFull) {          apiOptionsSave();          conditionsClearCaches(profileConditionsDescriptor);      }; +    profileConditionsContainer.isolate = utilBackgroundIsolate;  }  function profileOptionsPopulateSelect(select, profiles, currentValue, ignoreIndices) { |