Verified Commit 7650629c authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Tie staging environment to strict blocking policies

parent 1a49a819
...@@ -41,7 +41,8 @@ main._initializeOptions = function () { ...@@ -41,7 +41,8 @@ main._initializeOptions = function () {
options = optionDefaults; // Restore option defaults. options = optionDefaults; // Restore option defaults.
} }
if (options.enforceStaging === true) { if (options.enforceStaging === true ||
options.blockMissing === true) {
// Improve coverage at the cost of website stability. // Improve coverage at the cost of website stability.
stateManager.setExtensionEnvironment('staging'); stateManager.setExtensionEnvironment('staging');
......
...@@ -30,6 +30,14 @@ messenger._handleMessageReceived = function (message, sender, sendResponse) { ...@@ -30,6 +30,14 @@ messenger._handleMessageReceived = function (message, sender, sendResponse) {
topic = message.topic; topic = message.topic;
value = message.value; value = message.value;
if (topic === 'extension:set-environment') {
stateManager.setExtensionEnvironment(value);
sendResponse({value});
return MessageResponse.SYNCHRONOUS;
}
if (topic === 'tab:fetch-injections') { if (topic === 'tab:fetch-injections') {
sendResponse({'value': stateManager.tabs[value].injections}); sendResponse({'value': stateManager.tabs[value].injections});
......
...@@ -205,11 +205,23 @@ options._onOptionChanged = function ({target}) { ...@@ -205,11 +205,23 @@ options._onOptionChanged = function ({target}) {
if (optionKey === Setting.BLOCK_MISSING) { if (optionKey === Setting.BLOCK_MISSING) {
let preferredEnvironment = 'stable';
if (optionValue === true) { if (optionValue === true) {
options._renderBlockMissingNotice(); options._renderBlockMissingNotice();
preferredEnvironment = 'staging';
} else { } else {
options._hideBlockMissingNotice(); options._hideBlockMissingNotice();
} }
let message = {
'topic': 'extension:set-environment',
'value': preferredEnvironment
};
chrome.runtime.sendMessage(message);
} }
if (optionKey === Setting.DISABLE_PREFETCH) { if (optionKey === Setting.DISABLE_PREFETCH) {
......
Supports Markdown
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