Bug 1456005 - Set LOAD_DISABLE_TRR flag in CaptiveDetect.jsm r=mayhemer
authorValentin Gosu <valentin.gosu@gmail.com>
Fri, 05 Apr 2019 12:08:57 +0000
changeset 468128 f002275ecacad6271efb2dff75699e5714847da7
parent 468127 504f75873604f7acf4e052bfb3c26f10336ff9b3
child 468129 edeb3a9d5b066127224b93e9c209b6b67640a402
push id35820
push userbtara@mozilla.com
push dateFri, 05 Apr 2019 16:17:46 +0000
treeherdermozilla-central@9b83eeea8a82 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1456005
milestone68.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 1456005 - Set LOAD_DISABLE_TRR flag in CaptiveDetect.jsm r=mayhemer This is useful to prevent issues in TRR mode 2 when a captive portal redirect occurs via DNS. For example, if we are in an unlocked CP and in suddenly locks, we must make sure that we don't use a cached DNS entry from when the portal was unlocked. This is especially relevant in split horizon situations. This isn't useful in TRR mode 3, as the flag would just cause the resolution to fail. For that we need to add the captive portal URI to the TRR exclusion list. Differential Revision: https://phabricator.services.mozilla.com/D25619
toolkit/components/captivedetect/CaptiveDetect.jsm
--- a/toolkit/components/captivedetect/CaptiveDetect.jsm
+++ b/toolkit/components/captivedetect/CaptiveDetect.jsm
@@ -24,16 +24,18 @@ function URLFetcher(url, timeout) {
   let xhr = new XMLHttpRequest();
   xhr.open("GET", url, true);
   // Prevent the request from reading from the cache.
   xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
   // Prevent the request from writing to the cache.
   xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
   // Prevent privacy leaks
   xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_ANONYMOUS;
+  // Use the system's resolver for this check
+  xhr.channel.loadFlags |= Ci.nsIRequest.LOAD_DISABLE_TRR;
   // The Cache-Control header is only interpreted by proxies and the
   // final destination. It does not help if a resource is already
   // cached locally.
   xhr.setRequestHeader("Cache-Control", "no-cache");
   // HTTP/1.0 servers might not implement Cache-Control and
   // might only implement Pragma: no-cache
   xhr.setRequestHeader("Pragma", "no-cache");