From 352d214203fba929594c6139189fa59c6772c69f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 17 Sep 2019 21:23:21 -0400 Subject: Isolate objects to background window --- ext/bg/js/conditions-ui.js | 15 ++++++++++++--- 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) { -- cgit v1.2.3