Bug 1397306 - Empty noProxy list should reset no proxy exclusions. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 07 Sep 2017 10:21:36 +0200
changeset 660609 9d3dd14ee6f21ff04338aad5682b71b392a65150
parent 659065 3ecda4678c49ca255c38b1697142b9118cdd27e7
child 730297 e4079c7d7fe42415613fefffce687a397cfb1719
push id78467
push userbmo:hskupin@gmail.com
push dateThu, 07 Sep 2017 08:22:03 +0000
bugs1397306
milestone57.0a1
Bug 1397306 - Empty noProxy list should reset no proxy exclusions. To allow resetting the default no proxy exclusion entries in Firefox tests have to pass an empty noProxy list. This should also be correctly applied. MozReview-Commit-ID: ABmYdPvoSvx
testing/marionette/session.js
testing/marionette/test_session.js
--- a/testing/marionette/session.js
+++ b/testing/marionette/session.js
@@ -170,17 +170,17 @@ session.Proxy = class {
           if (Number.isInteger(this.socksProxyPort)) {
             Preferences.set("network.proxy.socks_port", this.socksProxyPort);
           }
           if (this.socksVersion) {
             Preferences.set("network.proxy.socks_version", this.socksVersion);
           }
         }
 
-        if (this.noProxy && this.noProxy.length > 0) {
+        if (this.noProxy) {
           Preferences.set("network.proxy.no_proxies_on", this.noProxy.join(", "));
         }
         return true;
 
       case "pac":
         Preferences.set("network.proxy.type", 2);
         Preferences.set(
             "network.proxy.autoconfig_url", this.proxyAutoconfigUrl);
--- a/testing/marionette/test_session.js
+++ b/testing/marionette/test_session.js
@@ -162,16 +162,23 @@ add_test(function test_Proxy_init() {
     equal(Preferences.get("network.proxy.no_proxies_on"), "foo, bar");
     equal(Preferences.get(`network.proxy.${proxy}`), "foo");
     equal(Preferences.get(`network.proxy.${proxy}_port`), 42);
     if (proxy === "socks") {
       equal(Preferences.get(`network.proxy.${proxy}_version`), 4);
     }
   }
 
+  // empty no proxy should reset default exclustions
+  p = new session.Proxy();
+  p.proxyType = "manual";
+  p.noProxy = [];
+  ok(p.init());
+  equal(Preferences.get("network.proxy.no_proxies_on"), "");
+
   run_next_test();
 });
 
 add_test(function test_Proxy_toString() {
   equal(new session.Proxy().toString(), "[object session.Proxy]");
 
   run_next_test();
 });