summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhackademix2019-05-26 15:42:00 +0200
committerhackademix2019-05-26 15:42:00 +0200
commit23fb55bf38469a5dcc2dd7b8c45807f5535d6382 (patch)
treeab444b03dbe5af311d55af4ce7109eb1b8de9166 /src/common
parentb06ec5d1c81fe24f1e0c853a22360c29b1051f4a (diff)
downloadnoscript-23fb55bf38469a5dcc2dd7b8c45807f5535d6382.tar.gz
noscript-23fb55bf38469a5dcc2dd7b8c45807f5535d6382.tar.xz
noscript-23fb55bf38469a5dcc2dd7b8c45807f5535d6382.zip
More accurate algorithm to account for permissions changes in the UI triggering automatic reloads.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Policy.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/common/Policy.js b/src/common/Policy.js
index 4fbc4ec..c61596d 100644
--- a/src/common/Policy.js
+++ b/src/common/Policy.js
@@ -238,7 +238,20 @@ var {Permissions, Policy, Sites} = (() => {
}
return enabled;
}
-
+ sameAs(otherPerms) {
+ let otherCaps = new Set(otherPerms.capabilities);
+ let theseCaps = this.capabilities;
+ for (let c of theseCaps) {
+ if (!otherCaps.delete(c)) return false;
+ }
+ for (let c of otherCaps) {
+ if (!theseCaps.has(c)) return false;
+ }
+ return true;
+ }
+ clone() {
+ return new Permissions(this.capabilities, this.temp, this.context);
+ }
get tempTwin() {
return this._tempTwin || (this._tempTwin = new Permissions(this.capabilities, true, this.contextual));
}