Bug 1433500 - detectportal.firefox.com should return something informative for users r=nhnt11,extension-reviewers,zombie
authorValentin Gosu <valentin.gosu@gmail.com>
Tue, 06 Apr 2021 14:12:50 +0000
changeset 574539 2fcbc72daec56a94f5172fdc5baa5d5bd49ef85e
parent 574538 efc552e09df5e00d446f6642bb98c5f1ba6c0b72
child 574540 2d5c17a4324bf88c2e7cf5030dbd7d9be4f34788
push id140232
push uservalentin.gosu@gmail.com
push dateTue, 06 Apr 2021 14:15:16 +0000
treeherderautoland@2fcbc72daec5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnhnt11, extension-reviewers, zombie
bugs1433500
milestone89.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 1433500 - detectportal.firefox.com should return something informative for users r=nhnt11,extension-reviewers,zombie This change constitutes a way we can redirect users to an actual page that explains what captive portals are and why we are making these requests. Normally users should not see this page, as we only compare the contents of a small html file. The meta redirect only happens when loaded in a page. The SUMO URL https://support.mozilla.org/kb/captive-portal will automatically redirect to the appropriate locale. Differential Revision: https://phabricator.services.mozilla.com/D99773
modules/libpref/init/all.js
netwerk/test/unit/test_captive_portal_service.js
toolkit/components/extensions/test/xpcshell/test_ext_captivePortal.js
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4021,18 +4021,18 @@ pref("network.trr.confirmationNS", "exam
 pref("network.trr.bootstrapAddress", "");
 // TRR blacklist entry expire time (in seconds). Default is one minute.
 // Meant to survive basically a page load.
 pref("network.trr.blacklist-duration", 60);
 // Comma separated list of domains that we should not use TRR for
 pref("network.trr.excluded-domains", "");
 pref("network.trr.builtin-excluded-domains", "localhost,local");
 
-pref("captivedetect.canonicalURL", "http://detectportal.firefox.com/success.txt");
-pref("captivedetect.canonicalContent", "success\n");
+pref("captivedetect.canonicalURL", "http://detectportal.firefox.com/canonical.html");
+pref("captivedetect.canonicalContent", "<meta http-equiv=\"refresh\" content=\"0;url=https://support.mozilla.org/kb/captive-portal\"/>");
 pref("captivedetect.maxWaitingTime", 5000);
 pref("captivedetect.pollingTime", 3000);
 pref("captivedetect.maxRetryCount", 5);
 
 // The tables used for Safebrowsing phishing and malware checks
 pref("urlclassifier.malwareTable", "goog-malware-proto,goog-unwanted-proto,moztest-harmful-simple,moztest-malware-simple,moztest-unwanted-simple");
 #ifdef MOZILLA_OFFICIAL
   // In official builds, we are allowed to use Google's private phishing
--- a/netwerk/test/unit/test_captive_portal_service.js
+++ b/netwerk/test/unit/test_captive_portal_service.js
@@ -2,17 +2,18 @@
 
 const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
 
 let httpserver = null;
 XPCOMUtils.defineLazyGetter(this, "cpURI", function() {
   return "http://localhost:" + httpserver.identity.primaryPort + "/captive.txt";
 });
 
-const SUCCESS_STRING = "success\n";
+const SUCCESS_STRING =
+  '<meta http-equiv="refresh" content="0;url=https://support.mozilla.org/kb/captive-portal"/>';
 let cpResponse = SUCCESS_STRING;
 function contentHandler(metadata, response) {
   response.setHeader("Content-Type", "text/plain");
   response.bodyOutputStream.write(cpResponse, cpResponse.length);
 }
 
 const PREF_CAPTIVE_ENABLED = "network.captive-portal-service.enabled";
 const PREF_CAPTIVE_TESTMODE = "network.captive-portal-service.testMode";
--- a/toolkit/components/extensions/test/xpcshell/test_ext_captivePortal.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_captivePortal.js
@@ -6,17 +6,18 @@
  */
 
 const PREF_CAPTIVE_ENABLED = "network.captive-portal-service.enabled";
 const PREF_CAPTIVE_TESTMODE = "network.captive-portal-service.testMode";
 const PREF_CAPTIVE_MINTIME = "network.captive-portal-service.minInterval";
 const PREF_CAPTIVE_ENDPOINT = "captivedetect.canonicalURL";
 const PREF_DNS_NATIVE_IS_LOCALHOST = "network.dns.native-is-localhost";
 
-const SUCCESS_STRING = "success\n";
+const SUCCESS_STRING =
+  '<meta http-equiv="refresh" content="0;url=https://support.mozilla.org/kb/captive-portal"/>';
 let cpResponse = SUCCESS_STRING;
 
 const httpserver = createHttpServer();
 httpserver.registerPathHandler("/captive.txt", (request, response) => {
   response.setStatusLine(request.httpVersion, 200, "OK");
   response.setHeader("Content-Type", "text/plain");
   response.write(cpResponse);
 });