From a4068d5eb096015709b98575fa98a77c06d8030b Mon Sep 17 00:00:00 2001 From: Andrew Hurle Date: Thu, 24 May 2012 18:45:09 -0400 Subject: [PATCH] Bug 566444 - Make proxy exceptions multiline. r=jaws --- browser/components/preferences/connection.js | 13 +- browser/components/preferences/connection.xul | 14 +- .../preferences/in-content/tests/Makefile.in | 1 + .../in-content/tests/browser_connection.js | 128 ++++++++++++++++++ 4 files changed, 143 insertions(+), 13 deletions(-) create mode 100644 browser/components/preferences/in-content/tests/browser_connection.js diff --git a/browser/components/preferences/connection.js b/browser/components/preferences/connection.js index 077ea4b5dde..d369d134aea 100644 --- a/browser/components/preferences/connection.js +++ b/browser/components/preferences/connection.js @@ -32,8 +32,7 @@ var gConnectionsDialog = { } } - var noProxiesPref = document.getElementById("network.proxy.no_proxies_on"); - noProxiesPref.value = noProxiesPref.value.replace(/[;]/g,','); + this.sanitizeNoProxiesPref(); return true; }, @@ -159,6 +158,16 @@ var gConnectionsDialog = { autoURLPref.value = autoURL.value = URIFixup.createFixupURI(autoURL.value, 0).spec; } catch(ex) {} }, + + sanitizeNoProxiesPref: function() + { + var noProxiesPref = document.getElementById("network.proxy.no_proxies_on"); + // replace substrings of ; and \n with commas if they're neither immediately + // preceded nor followed by a valid separator character + noProxiesPref.value = noProxiesPref.value.replace(/([^, \n;])[;\n]+(?![,\n;])/g, '$1,'); + // replace any remaining ; and \n since some may follow commas, etc. + noProxiesPref.value = noProxiesPref.value.replace(/[;\n]/g, ''); + }, readHTTPProxyServer: function () { diff --git a/browser/components/preferences/connection.xul b/browser/components/preferences/connection.xul index 6bd5052e760..24531261e11 100644 --- a/browser/components/preferences/connection.xul +++ b/browser/components/preferences/connection.xul @@ -139,17 +139,9 @@ - - - - - - - - - +