Add kill switch mechanism
This code implements the kill switch mechanism in the extension. This is
explained in //src/killSwitch/README.md and in the design doc:
https://docs.google.com/document/d/1O5YV6_WcxwrUyz-lwHOSTfZ3oyIFWj2EQee0VuKkhaA/edit.
Bug: twpowertools:64
Change-Id: Ia993c78035bba7038aafd53d156f20954217e86f
diff --git a/src/optionsCommon.js b/src/optionsCommon.js
index 42983a5..27db635 100644
--- a/src/optionsCommon.js
+++ b/src/optionsCommon.js
@@ -108,13 +108,26 @@
var featuresLink = document.querySelector('.features-link');
featuresLink.href = getDocURL('features.md');
- var profileIndicatorLink = document.getElementById('profileIndicatorMoreInfo');
+ var profileIndicatorLink =
+ document.getElementById('profileIndicatorMoreInfo');
profileIndicatorLink.href = getDocURL('op_indicator.md');
}
chrome.storage.sync.get(null, function(items) {
items = cleanUpOptions(items, false);
+ // If some features have been force disabled, communicate this to the user.
+ if (items?._forceDisabledFeatures &&
+ items._forceDisabledFeatures.length > 0) {
+ if (window.CONTEXT == 'options') {
+ document.getElementById('kill-switch-warning')
+ .removeAttribute('hidden');
+ }
+
+ // TODO(avm99963): show a message above each option that has been force
+ // disabled
+ }
+
for (var entry of Object.entries(optionsPrototype)) {
var opt = entry[0];
var optMeta = entry[1];