From 0343c8cc0096fa3156396e67681c955351c78bb2 Mon Sep 17 00:00:00 2001 From: Lesley Norton Date: Mon, 1 Nov 2021 16:59:47 -0500 Subject: [PATCH] Fix bug when opening custom proxy panel --- src/js/popup.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/js/popup.js b/src/js/popup.js index 62ffeba..171b215 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -1929,10 +1929,18 @@ Logic.registerPanel(P_ADVANCED_PROXY_SETTINGS, { async prepare() { const identity = Logic.currentIdentity(); - console.log(this._advancedProxyInput); + const advancedProxyInput = document.getElementById("edit-advanced-proxy-input"); // reset input - this._advancedProxyInput.value = ""; + const resetProxyInput = () => { + if (!advancedProxyInput) { + return; + } + advancedProxyInput.value = ""; + }; + + resetProxyInput(); + this.hideInvalidEntryWarning(); const setProxyInputPlaceholder = (proxy) => { @@ -1941,7 +1949,7 @@ Logic.registerPanel(P_ADVANCED_PROXY_SETTINGS, { const edit_proxy_dom = function(proxy) { if (proxy.type === "direct" || typeof proxy.type === "undefined" || MozillaVPN.proxyIsDisabled(proxy)) { - this._advancedProxyInput.value = ""; + resetProxyInput(); return; } return setProxyInputPlaceholder(proxy); @@ -1951,7 +1959,7 @@ Logic.registerPanel(P_ADVANCED_PROXY_SETTINGS, { if (proxyData) { edit_proxy_dom(proxyData.proxy); } else { - this._advancedProxyInput.value = ""; + resetProxyInput(); } const containerColor = document.querySelector(".proxy-title-container-color"); containerColor.dataset.identityColor = identity.color;