Created Utils.DEFAULT_PROXY and referenced it everywhere
This commit is contained in:
parent
f47b4c8f6c
commit
66cde07135
4 changed files with 15 additions and 6 deletions
|
@ -119,7 +119,7 @@ const assignManager = {
|
|||
|
||||
async handleProxifiedRequest(requestInfo) {
|
||||
if(requestInfo.tabId === -1)
|
||||
return {type: "direct"};
|
||||
return Utils.DEFAULT_PROXY;
|
||||
|
||||
const tab = await browser.tabs.get(requestInfo.tabId);
|
||||
const proxy = await proxifiedContainers.retrieveFromBackground(tab.cookieStoreId);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
"js/background/messageHandler.js",
|
||||
]
|
||||
-->
|
||||
<script type="text/javascript" src="../utils.js"></script>
|
||||
<script type="text/javascript" src="../proxified-containers.js"></script>
|
||||
<script type="text/javascript" src="backgroundLogic.js"></script>
|
||||
<script type="text/javascript" src="assignManager.js"></script>
|
||||
|
|
|
@ -7,7 +7,6 @@ const CONTAINER_UNHIDE_SRC = "/img/container-unhide.svg";
|
|||
const DEFAULT_COLOR = "blue";
|
||||
const DEFAULT_ICON = "circle";
|
||||
const NEW_CONTAINER_ID = "new";
|
||||
const DEFAULT_PROXY = {type: "direct"};
|
||||
|
||||
const ONBOARDING_STORAGE_KEY = "onboarding-stage";
|
||||
|
||||
|
@ -967,7 +966,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||
icon: formValues.get("container-icon") || DEFAULT_ICON,
|
||||
color: formValues.get("container-color") || DEFAULT_COLOR
|
||||
},
|
||||
proxy: proxifiedContainers.parseProxy(document.getElementById("edit-container-panel-proxy").value) || DEFAULT_PROXY
|
||||
proxy: proxifiedContainers.parseProxy(document.getElementById("edit-container-panel-proxy").value) || Utils.DEFAULT_PROXY
|
||||
}
|
||||
});
|
||||
await Logic.refreshIdentities();
|
||||
|
@ -1085,7 +1084,7 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||
edit_proxy_dom(result.proxy);
|
||||
}, (error) => {
|
||||
if(error.error === "uninitialized" || error.error === "doesnotexist") {
|
||||
proxifiedContainers.set(identity.cookieStoreId, DEFAULT_PROXY, error.error === "uninitialized").then((result) => {
|
||||
proxifiedContainers.set(identity.cookieStoreId, Utils.DEFAULT_PROXY, error.error === "uninitialized").then((result) => {
|
||||
edit_proxy_dom(result);
|
||||
}, (error) => {
|
||||
proxifiedContainers.report_proxy_error(error, "popup.js: unexpected set(...) error");
|
||||
|
|
|
@ -18,7 +18,16 @@ window.Utils = {
|
|||
imageElement.addEventListener("error", errorListener);
|
||||
imageElement.addEventListener("load", loadListener);
|
||||
return imageElement;
|
||||
},
|
||||
DEFAULT_PROXY: Object.freeze({type: "direct"})
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// 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
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue