- commit
- 02c9d282b17f0bbc714f6cac06d2dcfa12044090
- parent
- 39093383bf5a016a1c5d1903f4edbcee29ee10b0
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-07-30 19:32
send context in setRule
Diffstat
| M | bg.js | 12 | +++++++----- |
| M | popup.js | 10 | ++++++---- |
2 files changed, 13 insertions, 9 deletions
diff --git a/bg.js b/bg.js
@@ -76,11 +76,13 @@ browser.runtime.onMessage.addListener(msg => {
76 76 };
77 77 });
78 78 } else if (msg.type === 'setRule') {
79 -1 return getCurrentTab().then(tab => {
80 -1 var context = getHostname(tab.url);
81 -1 setRule(context, msg.data[0], msg.data[1], msg.data[2]);
82 -1 return restrictRules(context);
83 -1 });
-1 79 setRule(
-1 80 msg.data.context,
-1 81 msg.data.hostname,
-1 82 msg.data.type,
-1 83 msg.data.value,
-1 84 );
-1 85 return Promise.resolve(restrictRules(msg.data.context));
84 86 }
85 87 });
86 88
diff --git a/popup.js b/popup.js
@@ -67,10 +67,12 @@ var createCheckbox = function(hostname, type) {
67 67 input.checked = (rules[c][hostname] || {})[type];
68 68
69 69 input.onchange = () => {
70 -1 sendMessage(
71 -1 'setRule',
72 -1 [hostname, type, input.checked],
73 -1 ).then(newRules => {
-1 70 sendMessage('setRule', {
-1 71 context: context,
-1 72 hostname: hostname,
-1 73 type: type,
-1 74 value: input.checked,
-1 75 }).then(newRules => {
74 76 rules = newRules;
75 77 updateInherit(type);
76 78 });