bug 1503393 - verify default localhost not-proxied with PAC r=mayhemer
☠☠ backed out by 7670b6ce33a4 ☠ ☠
authorDaniel Stenberg <daniel@haxx.se>
Mon, 03 Dec 2018 16:27:29 +0200
changeset 508455 02e383b73c971e656097b3040e9cc523039018d6
parent 508454 49428012434e379316f2d831a088a27cf1b429ee
child 508456 7878029aaba609b5433d3eea98873a450cf2cb62
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1503393
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1503393 - verify default localhost not-proxied with PAC r=mayhemer
netwerk/test/unit/test_protocolproxyservice.js
--- a/netwerk/test/unit/test_protocolproxyservice.js
+++ b/netwerk/test/unit/test_protocolproxyservice.js
@@ -948,19 +948,50 @@ function run_isresolvable_test()
 
 function isresolvable_callback(pi)
 {
   Assert.notEqual(pi, null);
   Assert.equal(pi.type, "http");
   Assert.equal(pi.port, 1234);
   Assert.equal(pi.host, "127.0.0.1");
 
+  run_localhost_pac();
+}
+
+function run_localhost_pac()
+{
+  // test localhost in the pac file
+
+  var pac = 'data:text/plain,' +
+            'function FindProxyForURL(url, host) {' +
+            ' return "PROXY totallycrazy:1234";' +
+            '}';
+
+  // Use default filter list string for "no_proxies_on" ("localhost, 127.0.0.1")
+  prefs.clearUserPref("network.proxy.no_proxies_on");
+  var channel = NetUtil.newChannel({
+    uri: "http://localhost/",
+    loadUsingSystemPrincipal: true
+  });
+  prefs.setIntPref("network.proxy.type", 2);
+  prefs.setCharPref("network.proxy.autoconfig_url", pac);
+
+  var cb = new resolveCallback();
+  cb.nextFunction = localhost_callback;
+  var req = pps.asyncResolve(channel, 0, cb);
+}
+
+function localhost_callback(pi)
+{
+  Assert.equal(pi, null); // no proxy!
+
   prefs.setIntPref("network.proxy.type", 0);
   do_test_finished();
 }
 
+
 function run_test() {
   register_test_protocol_handler();
 
   // start of asynchronous test chain
   run_filter_test();
   do_test_pending();
 }