Skip to content
Snippets Groups Projects
Verified Commit 7650629c authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Tie staging environment to strict blocking policies

parent 1a49a819
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment