diff --git a/src/js/background/assignManager.js b/src/js/background/assignManager.js
index dd1fc5e..93d4790 100644
--- a/src/js/background/assignManager.js
+++ b/src/js/background/assignManager.js
@@ -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);
diff --git a/src/js/background/index.html b/src/js/background/index.html
index 86bccf1..cdbd82e 100644
--- a/src/js/background/index.html
+++ b/src/js/background/index.html
@@ -13,6 +13,7 @@
"js/background/messageHandler.js",
]
-->
+
diff --git a/src/js/popup.js b/src/js/popup.js
index 8dd3ff7..bdb2b87 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -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");
diff --git a/src/js/utils.js b/src/js/utils.js
index 86e18f0..b027824 100644
--- a/src/js/utils.js
+++ b/src/js/utils.js
@@ -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
+});