Microsoft has acquired GitHub. Decentraleyes has left GitHub. Welcome to its new home!

To participate, please register, or sign in with an existing GitLab.com, Bitbucket, or GitHub account.

Past contributions on GitHub? Be sure to reclaim your Comments, Issues, and Pull Requests.

Tie staging environment to strict blocking policies

parent 1a49a819
......@@ -41,7 +41,8 @@ main._initializeOptions = function () {
options = optionDefaults; // Restore option defaults.
}
if (options.enforceStaging === true) {
if (options.enforceStaging === true ||
options.blockMissing === true) {
// Improve coverage at the cost of website stability.
stateManager.setExtensionEnvironment('staging');
......
......@@ -30,6 +30,14 @@ messenger._handleMessageReceived = function (message, sender, sendResponse) {
topic = message.topic;
value = message.value;
if (topic === 'extension:set-environment') {
stateManager.setExtensionEnvironment(value);
sendResponse({value});
return MessageResponse.SYNCHRONOUS;
}
if (topic === 'tab:fetch-injections') {
sendResponse({'value': stateManager.tabs[value].injections});
......
......@@ -205,11 +205,23 @@ options._onOptionChanged = function ({target}) {
if (optionKey === Setting.BLOCK_MISSING) {
let preferredEnvironment = 'stable';
if (optionValue === true) {
options._renderBlockMissingNotice();
preferredEnvironment = 'staging';
} else {
options._hideBlockMissingNotice();
}
let message = {
'topic': 'extension:set-environment',
'value': preferredEnvironment
};
chrome.runtime.sendMessage(message);
}
if (optionKey === Setting.DISABLE_PREFETCH) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment