bug 1498525 - make test_captive_portal_service use localhost only r=valentin
authorDaniel Stenberg <daniel@haxx.se>
Thu, 18 Oct 2018 07:06:43 +0000
changeset 500325 9305a99ea1c3aab53a9675be0f76ec60b1a30e5b
parent 500324 aa851fc2ed73e31c338e9a1ba8f8538b0845d219
child 500326 8d820a4fe6e63e80cb05e5c27351b7a3fdf57577
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1498525
milestone64.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 1498525 - make test_captive_portal_service use localhost only r=valentin By setting network.dns.native-is-localhost in this test, it makes all native name resolves use "localhost" and thus avoids causing an assert if this test runs with TRR enabled and network.trr.uri set to point to an actual external host name. MozReview-Commit-ID: D1df6VtfckR Differential Revision: https://phabricator.services.mozilla.com/D9070
netwerk/test/unit/test_captive_portal_service.js
--- a/netwerk/test/unit/test_captive_portal_service.js
+++ b/netwerk/test/unit/test_captive_portal_service.js
@@ -16,23 +16,25 @@ function contentHandler(metadata, respon
   response.bodyOutputStream.write(cpResponse, cpResponse.length);
 }
 
 const PREF_CAPTIVE_ENABLED = "network.captive-portal-service.enabled";
 const PREF_CAPTIVE_TESTMODE = "network.captive-portal-service.testMode";
 const PREF_CAPTIVE_ENDPOINT = "captivedetect.canonicalURL";
 const PREF_CAPTIVE_MINTIME = "network.captive-portal-service.minInterval";
 const PREF_CAPTIVE_MAXTIME = "network.captive-portal-service.maxInterval";
+const PREF_DNS_NATIVE_IS_LOCALHOST = "network.dns.native-is-localhost";
 
 registerCleanupFunction(() => {
   Services.prefs.clearUserPref(PREF_CAPTIVE_ENABLED);
   Services.prefs.clearUserPref(PREF_CAPTIVE_TESTMODE);
   Services.prefs.clearUserPref(PREF_CAPTIVE_ENDPOINT);
   Services.prefs.clearUserPref(PREF_CAPTIVE_MINTIME);
   Services.prefs.clearUserPref(PREF_CAPTIVE_MAXTIME);
+  Services.prefs.clearUserPref(PREF_DNS_NATIVE_IS_LOCALHOST);
 
   httpserver.stop(() => {});
 });
 
 function observerPromise(topic) {
   return new Promise(resolve => {
     let observer = {
       QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
@@ -51,17 +53,17 @@ add_task(function setup(){
   httpserver = new HttpServer();
   httpserver.registerPathHandler("/captive.txt", contentHandler);
   httpserver.start(-1);
 
   Services.prefs.setCharPref(PREF_CAPTIVE_ENDPOINT, cpURI);
   Services.prefs.setIntPref(PREF_CAPTIVE_MINTIME, 50);
   Services.prefs.setIntPref(PREF_CAPTIVE_MAXTIME, 100);
   Services.prefs.setBoolPref(PREF_CAPTIVE_TESTMODE, true);
-
+  Services.prefs.setBoolPref(PREF_DNS_NATIVE_IS_LOCALHOST, true);
 });
 
 add_task(async function test_simple()
 {
   var cps = Cc["@mozilla.org/network/captive-portal-service;1"]
               .getService(Ci.nsICaptivePortalService);
   Services.prefs.setBoolPref(PREF_CAPTIVE_ENABLED, false);