Remove DEFAULT_PROXY

This commit is contained in:
Andrea Marchesini 2021-10-22 17:32:04 +02:00
parent 37ed2455eb
commit 3572bebbd9
3 changed files with 3 additions and 21 deletions

View file

@ -187,21 +187,14 @@ window.assignManager = {
async handleProxifiedRequest(requestInfo) { async handleProxifiedRequest(requestInfo) {
// The following blocks potentially dangerous requests for privacy that come without a tabId // The following blocks potentially dangerous requests for privacy that come without a tabId
// Dupe of Utils.DEFAULT_PROXY, which was occasionally and unreliably
// not being found on startup and causing significant UI grief.
if(requestInfo.tabId === -1) { if(requestInfo.tabId === -1) {
return { return {type: "direct"};
value: Object.freeze({type: "direct"}),
writable: false,
enumerable: true,
configurable: false
};
} }
const tab = await browser.tabs.get(requestInfo.tabId); const tab = await browser.tabs.get(requestInfo.tabId);
const result = await proxifiedContainers.retrieve(tab.cookieStoreId); const result = await proxifiedContainers.retrieve(tab.cookieStoreId);
if (!result || !result.proxy) { if (!result || !result.proxy) {
return Utils.DEFAULT_PROXY; return {type: "direct"};
} }
if (!result.proxy.mozProxyEnabled) { if (!result.proxy.mozProxyEnabled) {

View file

@ -1824,8 +1824,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
return; return;
} }
await proxifiedContainers.set(identity.cookieStoreId, Utils.DEFAULT_PROXY); mozillaVpnUi.updateProxyDependentUi({});
mozillaVpnUi.updateProxyDependentUi(Utils.DEFAULT_PROXY);
}, },
}); });

View file

@ -169,13 +169,3 @@ const Utils = {
}; };
window.Utils = Utils; window.Utils = Utils;
// The following creates a fake (but convincing) constant Utils.DEFAULT_PROXY
Object.defineProperty(window.Utils, "DEFAULT_PROXY", {
value: Object.freeze({type: "direct"}),
writable: false,
enumerable: true,
// Setting configurable to false avoids deletion of Utils.DEFAULT_PROXY
configurable: false
});